From: Tu Truong Date: Sat, 19 May 2012 00:09:14 +0000 (-0700) Subject: "Initial commit to Gerrit" X-Git-Tag: "1.10.2-05182012"^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=59d5dfc81fe9c2e19488339b760a1f71ffb72914;p=profile%2Fivi%2Fcogl.git "Initial commit to Gerrit" --- 59d5dfc81fe9c2e19488339b760a1f71ffb72914 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..4362b49 --- /dev/null +++ b/COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + 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 Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +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 other code 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. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + 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, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser 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 combine 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) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) 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. + + d) 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. + + e) 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 materials to be 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 with +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 Lesser 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/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..bbb16ae --- /dev/null +++ b/Makefile.am @@ -0,0 +1,33 @@ +SUBDIRS = cogl tests + +if BUILD_COGL_PANGO +SUBDIRS += cogl-pango +endif + +SUBDIRS += 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 + +include $(top_srcdir)/build/autotools/Makefile.am.release diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..ed39a21 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1025 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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_PANGO_TRUE@am__append_1 = cogl-pango +DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/README.in \ + $(srcdir)/config.h.in $(srcdir)/config.h.win32.in \ + $(top_srcdir)/build/autotools/Makefile.am.release \ + $(top_srcdir)/configure ABOUT-NLS COPYING ChangeLog NEWS +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = cogl tests cogl-pango examples doc po build +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(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.bz2 +distuninstallcheck_listfiles = find . -type f -print +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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 tests $(am__append_1) 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 + +TAR_OPTIONS = --owner=0 --group=0 +RELEASE_UPLOAD_HOST = clutter-project.org +RELEASE_UPLOAD_USER = clutter +RELEASE_UPLOAD_DIR = $(RELEASE_UPLOAD_USER)@$(RELEASE_UPLOAD_HOST):~$(RELEASE_UPLOAD_USER)/upload-source +RELEASE_URL_BASE = http://source.clutter-project.org/sources/clutter +RELEASE_URL = $(RELEASE_URL_BASE)/$(COGL_MAJOR_VERSION).$(COGL_MINOR_VERSION) +RELEASE_ANNOUNCE_LIST = cogl3d@googlegroups.com, clutter-announce@clutter-project.org +RELEASE_ANNOUNCE_CC = gnome-announce-list@gnome.org +RELEASE_DOC_URL = http://docs.clutter-project.org/docs/ +tar_file = $(distdir).tar.bz2 +sha256_file = $(distdir).sha256sum +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(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_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 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__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.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(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 a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(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 --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(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__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: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-lzma 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-recursive 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 $(RELEASE_UPLOAD_HOST)..." + @scp $(tar_file) $(RELEASE_UPLOAD_DIR) + @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://source.clutter-project.org/sources/cogl/1.$(COGL_1_MINOR_VERSION)/" + @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 API is documented here:" + @echo " http://docs.clutter-project.org/docs/cogl/1.$(COGL_1_MINOR_VERSION)" + @echo "The experimental 2.0 API is documented here:" + @echo " http://docs.clutter-project.org/docs/cogl-2.0-experimental/1.$(COGL_1_MINOR_VERSION)" + @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..aa7fc5d --- /dev/null +++ b/NEWS @@ -0,0 +1,704 @@ +Cogl 1.10.2 2012-04-19 + + • List of changes since Cogl 1.10.0 + + » Fix for fallback path in cogl_texture_get_data when reading from + an FBO doesn't work + » Bug fix to make cogl_pipeline_get_depth_state work + » The cogl-crate and cogl-msaa examples now show error messages if + it fails to initialise + » cogl_context_new no longer crashes if initialisation fails when + passed a NULL display + » Visual Studio build fixes + » Translation updates + + • List of bugs fixed since Cogl 1.10.0 + + https://bugzilla.gnome.org: + + #672533 - Quartz image option causes compile error + #673137 - Grab the current window -> Screenshot is mirrored + +Many thanks to: + + Robert Bragg + Chun-wei Fan + Adel Gadllah + Bruno Brouard + Gabor Kelemen + Krishnababu Krothapalli + Rajesh Ranjan + Yinghua Wang + +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.in b/README.in new file mode 100644 index 0000000..4fbf8e3 --- /dev/null +++ b/README.in @@ -0,0 +1,164 @@ +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: + + • GLib ≥ @GLIB_REQ_VERSION@ + • 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: + + • 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@ + +On X11, Cogl depends on the following extensions + + • XComposite ≥ @XCOMPOSITE_REQ_VERSION@ + • XDamage + • XExt + • XFixes ≥ @XFIXES_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 API references for the latest stable release are available at: + + http://docs.clutter-project.org/docs/cogl/stable/ + +The experimental 2.0 API can be found here: + + http://docs.clutter-project.org/docs/cogl-2.0-experimental/stable/ + + Note: The confusing "stable" at the end refers to the overall Cogl release + status, not the documentation specifically. + +-- +LICENSE +------------------------------------------------------------------------------- + +Most of Cogl is licensed under the terms of the GNU Lesser General Public +License, version 2.1 or (at your option) later. Some files are licensed under +more permissive licenses MIT or BSD style licenses though so please see +individual files for details. + +-- +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..58b5f1c --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1421 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 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_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. +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)?$]) +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`], + [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 "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$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]) + ]) +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 .]) + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 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.11' +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.11.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.11.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, 2003, 2005 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, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# 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. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$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, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# 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. + +# serial 10 + +# 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", "GCJ", or "OBJC". +# 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 + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" 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'. + 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 8's {/usr,}/bin/sh. + touch 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 + ;; + 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, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# 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. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 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"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 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. + +# serial 16 + +# 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. + +# 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.62])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], +[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], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [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([AM_PROG_MKDIR_P])dnl +# 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)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl 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 +]) + +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, 2003, 2005, 2008 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, 2005 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. + +# serial 2 + +# 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, 2002, 2003, 2005, 2009 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. + +# serial 4 + +# 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 +]) + +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# 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. + +# serial 6 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != 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 +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# 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. + +# serial 6 + +# 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 supports --run. +# If it does, 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 --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 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 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, 2002, 2003, 2005, 2008 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. + +# serial 4 + +# _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) 2001, 2003, 2005 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, 1997, 2000, 2001, 2003, 2005, 2008 +# 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. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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 ( + 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 + rm -f conftest.file + 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 + + 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)]) + +# Copyright (C) 2009 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. + +# serial 1 + +# 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], +[ --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0')]) +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 +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001, 2003, 2005 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, 2008 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. + +# serial 2 + +# _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, 2005 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. + +# serial 2 + +# _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. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +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 + +# 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; + char *tmp_version; + + fclose (fopen ("conf.glibtest", "w")); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_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 +]) + +m4_include([build/autotools/as-compiler-flag.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/introspection.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]) 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..dc8c8e0 --- /dev/null +++ b/build/Makefile.in @@ -0,0 +1,669 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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.am $(srcdir)/Makefile.in compile \ + config.guess config.rpath config.sub depcomp install-sh \ + ltmain.sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive 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-recursive \ + 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..6a536e5 --- /dev/null +++ b/build/autotools/Makefile.am.release @@ -0,0 +1,170 @@ +# To make real stable releases or devel snapshots, use either: +# make release-check +# or make release-publish + +TAR_OPTIONS = --owner=0 --group=0 + +RELEASE_UPLOAD_HOST = clutter-project.org +RELEASE_UPLOAD_USER = clutter +RELEASE_UPLOAD_DIR = $(RELEASE_UPLOAD_USER)@$(RELEASE_UPLOAD_HOST):~$(RELEASE_UPLOAD_USER)/upload-source + +RELEASE_URL_BASE = http://source.clutter-project.org/sources/clutter +RELEASE_URL = $(RELEASE_URL_BASE)/$(COGL_MAJOR_VERSION).$(COGL_MINOR_VERSION) + +RELEASE_ANNOUNCE_LIST = cogl3d@googlegroups.com, clutter-announce@clutter-project.org +RELEASE_ANNOUNCE_CC = gnome-announce-list@gnome.org + +RELEASE_DOC_URL = http://docs.clutter-project.org/docs/ + +tar_file = $(distdir).tar.bz2 +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 $(RELEASE_UPLOAD_HOST)..." + @scp $(tar_file) $(RELEASE_UPLOAD_DIR) + @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://source.clutter-project.org/sources/cogl/1.$(COGL_1_MINOR_VERSION)/" + @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 API is documented here:" + @echo " http://docs.clutter-project.org/docs/cogl/1.$(COGL_1_MINOR_VERSION)" + @echo "The experimental 2.0 API is documented here:" + @echo " http://docs.clutter-project.org/docs/cogl-2.0-experimental/1.$(COGL_1_MINOR_VERSION)" + @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/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-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..0ada151 --- /dev/null +++ b/build/autotools/gtk-doc.m4 @@ -0,0 +1,67 @@ +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 + + + 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/introspection.m4 b/build/autotools/introspection.m4 new file mode 100644 index 0000000..589721c --- /dev/null +++ b/build/autotools/introspection.m4 @@ -0,0 +1,94 @@ +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 + [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/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..88de383 --- /dev/null +++ b/build/autotools/libtool.m4 @@ -0,0 +1,7835 @@ +# 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 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 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([], [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) 2010 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)], + [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 + + +# _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([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 test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 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 -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; 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 +# -------------------------- +# 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\"`' + 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 + ;; +sparc*-*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*) LD="${LD-ld} -m elf64_sparc" ;; + *) + 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 \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$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 + ;; + + 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"`func_fallback_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 + 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 + 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 + 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 + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +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[[123]]*) 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 + 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 + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux + 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 + 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 + 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 Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + 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 + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # 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="$sys_lib_dlsearch_path_spec $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 + 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 + 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 + 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 + 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 + 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 + 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 Linux 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};"\ +" /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 ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' + ;; + 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\ F* | *Sun*Fortran*) + # 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\ 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,' + ;; + 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(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_flag_spec_ld, $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)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $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(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 + ;; + + freebsd1*) + _LT_TAGVAR(ld_shlibs, $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_flag_spec_ld, $1)='+b $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_flag_spec_ld], [1], + [[If ld is used when linking, 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_flag_spec_ld, $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 + ;; + + freebsd[[12]]*) + # 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 +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +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_flag_spec_ld, $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_flag_spec_ld, $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_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_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..17cfd51 --- /dev/null +++ b/build/autotools/ltoptions.m4 @@ -0,0 +1,369 @@ +# 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], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [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..9c7b5d4 --- /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 3293 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4]) +m4_define([LT_PACKAGE_REVISION], [1.3293]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4' +macro_revision='1.3293' +_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..c0096a7 --- /dev/null +++ b/build/compile @@ -0,0 +1,143 @@ +#! /bin/sh +# Wrapper for compilers which do not understand `-c -o'. + +scriptversion=2009-10-06.20; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 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 +# . + +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 $? + ;; +esac + +ofile= +cfile= +eat= + +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..dc84c68 --- /dev/null +++ b/build/config.guess @@ -0,0 +1,1501 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-11-20' + +# 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 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, 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. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# 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 + +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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 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 + +# 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 tupples: *-*-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 ;; + *: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'` + exit ;; + 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:*:[456]) + 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:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + 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-gnu`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/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + 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="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${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-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + 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-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + 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-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + 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 ;; + 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 + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + 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 + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + 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 ;; + 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 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +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=/' <. Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# 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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 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-dietlibc | linux-newlib* | 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/'` + ;; + *) + 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*) + 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 \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | 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 \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | 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 | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-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-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | 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-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | 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-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | 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-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | 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 + ;; + 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) + 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'm not sure what "Sysv32" means. Should this be sysv3.2? + 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 + ;; + mingw32) + basic_machine=i386-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-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + 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 + ;; + 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) basic_machine=powerpc-unknown + ;; + ppc-*) 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) + 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 + ;; + 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 + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-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 + ;; + 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* \ + | -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* \ + | -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* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -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 + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -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 + ;; + # 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 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + 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..df8eea7 --- /dev/null +++ b/build/depcomp @@ -0,0 +1,630 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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 outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +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" + +# 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 + +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 -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## 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). +## - 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 -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## 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. + tr ' ' ' +' < "$tmpdepfile" | +## 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. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -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 -eq 0; then : + else + 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 ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + 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 -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + 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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + 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 -eq 0; then : + else + 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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # 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.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + 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" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + 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:: \1 \\:p' >> "$depfile" + echo " " >> "$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..6781b98 --- /dev/null +++ b/build/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # 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 + 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 + 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 + trap '(exit $?); exit' 1 2 13 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 starting with `-'. + 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 + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # 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-writeable 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 -z "$d" && 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 100755 index 0000000..78cf017 --- /dev/null +++ b/build/ltmain.sh @@ -0,0 +1,9636 @@ + +# libtool (GNU libtool) 2.4 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 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) +# --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 +# 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 +TIMESTAMP="" +package_revision=1.3293 + +# 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'} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${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=: + 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 --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(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_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-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 | *.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_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $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 () +{ + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done + 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 -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' + + 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) + 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) + 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$dir" + # 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 + 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) + 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 + 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" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + 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 + 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" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + 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..28055d2 --- /dev/null +++ b/build/missing @@ -0,0 +1,376 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. +# Originally 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 + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +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 + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# 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..9a8060c --- /dev/null +++ b/build/win32/Makefile.in @@ -0,0 +1,668 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive 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-recursive \ + 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..9749881 --- /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/cogl1-context.h ../../cogl/cogl-bitmap.h ../../cogl/cogl-color.h ../../cogl/cogl-fixed.h ../../cogl/cogl-material-compat.h ../../cogl/cogl-matrix.h ../../cogl/cogl-offscreen.h ../../cogl/cogl-primitives.h ../../cogl/cogl-path.h ../../cogl/cogl-path-functions.h ../../cogl/cogl-shader.h ../../cogl/cogl-texture.h ../../cogl/cogl-types.h ../../cogl/cogl-vertex-buffer.h ../../cogl/cogl-clutter.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/cogl1-context.h ../../cogl/cogl-bitmap.h ../../cogl/cogl-color.h ../../cogl/cogl-fixed.h ../../cogl/cogl-material-compat.h ../../cogl/cogl-matrix.h ../../cogl/cogl-offscreen.h ../../cogl/cogl-primitives.h ../../cogl/cogl-path.h ../../cogl/cogl-path-functions.h ../../cogl/cogl-shader.h ../../cogl/cogl-texture.h ../../cogl/cogl-types.h ../../cogl/cogl-vertex-buffer.h ../../cogl/cogl-clutter.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..bfc0d66 --- /dev/null +++ b/build/win32/vs10/Makefile.am @@ -0,0 +1,29 @@ +EXTRA_DIST = \ + cogl.sln \ + cogl_sdl.sln \ + cogl.props \ + cogl.vcxproj \ + cogl.vcxprojin \ + cogl.vcxproj.filters \ + cogl.vcxproj.filtersin \ + cogl-pango.vcxproj \ + cogl-pango.vcxprojin \ + cogl-pango.vcxproj.filters \ + cogl-pango.vcxproj.filtersin \ + cogl-hello.vcxproj \ + cogl-hello.vcxproj.filters \ + cogl-sdl-hello.vcxproj \ + cogl-sdl-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 \ + install-sdl.vcxproj \ + README.txt diff --git a/build/win32/vs10/Makefile.in b/build/win32/vs10/Makefile.in new file mode 100644 index 0000000..73f793b --- /dev/null +++ b/build/win32/vs10/Makefile.in @@ -0,0 +1,494 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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_sdl.sln \ + cogl.props \ + cogl.vcxproj \ + cogl.vcxprojin \ + cogl.vcxproj.filters \ + cogl.vcxproj.filtersin \ + cogl-pango.vcxproj \ + cogl-pango.vcxprojin \ + cogl-pango.vcxproj.filters \ + cogl-pango.vcxproj.filtersin \ + cogl-hello.vcxproj \ + cogl-hello.vcxproj.filters \ + cogl-sdl-hello.vcxproj \ + cogl-sdl-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 \ + install-sdl.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 +TAGS: + +ctags: CTAGS +CTAGS: + + +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 \ + 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 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..e291430 --- /dev/null +++ b/build/win32/vs10/README.txt @@ -0,0 +1,73 @@ +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 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 SDL winsys is desired, you will also need the SDL libraries +from www.libsdl.org-building the SDL source package with Visual C++ 2010 +is recommended (working Visual C++ 2005 projects are included with it, upgrade +the projects one prompted), but one may want to use the VC8 binary packages +from that website. + +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 +-(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) 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) + +--Chun-wei Fan + (Adopted from the GTK+ Win32 VS README.txt file originally by Tor Lillqvist) diff --git a/build/win32/vs10/cogl-crate.vcxproj b/build/win32/vs10/cogl-crate.vcxproj new file mode 100644 index 0000000..c458302 --- /dev/null +++ b/build/win32/vs10/cogl-crate.vcxproj @@ -0,0 +1,172 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {DE1A2710-04BB-4C3D-90C1-B070E326B1CF} + cogl-crate + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;COGL_EXAMPLES_DATA="../share/cogl-$(CoglApiVersion)/examples-data/";$(BaseBuildDefines);%(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-$(CoglApiVersion)/examples-data/";$(BaseBuildDefines);%(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-$(CoglApiVersion)/examples-data/";$(BaseBuildDefines);%(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-$(CoglApiVersion)/examples-data/";$(BaseBuildDefines);%(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 + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-crate.vcxproj.filters b/build/win32/vs10/cogl-crate.vcxproj.filters new file mode 100644 index 0000000..512afe1 --- /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 + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-hello.vcxproj b/build/win32/vs10/cogl-hello.vcxproj new file mode 100644 index 0000000..5e4496d --- /dev/null +++ b/build/win32/vs10/cogl-hello.vcxproj @@ -0,0 +1,210 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F5A43C12-7032-428E-A56A-D294075FA493} + cogl-hello + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + true + + + Application + Unicode + + + Application + Unicode + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + true + Console + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + true + Console + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + true + Console + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-hello.vcxproj.filters b/build/win32/vs10/cogl-hello.vcxproj.filters new file mode 100644 index 0000000..84c9a46 --- /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 + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-info.vcxproj b/build/win32/vs10/cogl-info.vcxproj new file mode 100644 index 0000000..2e54051 --- /dev/null +++ b/build/win32/vs10/cogl-info.vcxproj @@ -0,0 +1,165 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} + coglinfo + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + true + true + false + + + MachineX64 + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-info.vcxproj.filters b/build/win32/vs10/cogl-info.vcxproj.filters new file mode 100644 index 0000000..225e706 --- /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 + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-msaa.vcxproj b/build/win32/vs10/cogl-msaa.vcxproj new file mode 100644 index 0000000..ff77e4b --- /dev/null +++ b/build/win32/vs10/cogl-msaa.vcxproj @@ -0,0 +1,165 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {44E864D4-8447-484D-9B16-D5405E0783CF} + coglmsaa + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + true + Console + true + true + false + + + MachineX64 + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-msaa.vcxproj.filters b/build/win32/vs10/cogl-msaa.vcxproj.filters new file mode 100644 index 0000000..94457e9 --- /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 + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-pango.vcxproj b/build/win32/vs10/cogl-pango.vcxproj new file mode 100644 index 0000000..930dfee --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxproj @@ -0,0 +1,202 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} + coglpango + Win32Proj + + + + DynamicLibrary + Unicode + true + + + DynamicLibrary + Unicode + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + true + true + false + true + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX86 + + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX64 + + + + + $(PreBuildCmd) + + + MaxSpeed + true + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + $(PreBuildCmd) + + + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + + + + + + + + + + {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..2b3b604 --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxproj.filters @@ -0,0 +1,20 @@ + + + + + {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 + + diff --git a/build/win32/vs10/cogl-pango.vcxproj.filtersin b/build/win32/vs10/cogl-pango.vcxproj.filtersin new file mode 100644 index 0000000..4e22b74 --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxproj.filtersin @@ -0,0 +1,16 @@ + + + + + {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" + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-pango.vcxprojin b/build/win32/vs10/cogl-pango.vcxprojin new file mode 100644 index 0000000..2c3f392 --- /dev/null +++ b/build/win32/vs10/cogl-pango.vcxprojin @@ -0,0 +1,198 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {FE5ABD0F-91E8-4AA5-9C1C-408427D5F768} + coglpango + Win32Proj + + + + DynamicLibrary + Unicode + true + + + DynamicLibrary + Unicode + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + true + true + false + true + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX86 + + + + + $(PreBuildCmd) + + + Disabled + $(DebugLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX64 + + + + + $(PreBuildCmd) + + + MaxSpeed + true + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + $(PreBuildCmd) + + + $(ReleaseLibBuildDefines);$(CoglPangoBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglPangoDef) + + + pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl-pango\cogl-pango.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX64 + + + +#include "coglpango.vs10.sourcefiles" + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-sdl-hello.vcxproj b/build/win32/vs10/cogl-sdl-hello.vcxproj new file mode 100644 index 0000000..fdfcde1 --- /dev/null +++ b/build/win32/vs10/cogl-sdl-hello.vcxproj @@ -0,0 +1,169 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0B5D144D-1872-42CD-8437-FFDCDD08C03E} + coglsdlhello + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + SDL.lib;SDLmain.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + SDL.lib;SDLmain.lib;%(AdditionalDependencies) + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + SDL.lib;SDLmain.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_2_0_API;$(BaseBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + SDL.lib;SDLmain.lib;%(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + + + + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl-sdl-hello.vcxproj.filters b/build/win32/vs10/cogl-sdl-hello.vcxproj.filters new file mode 100644 index 0000000..6bdc21a --- /dev/null +++ b/build/win32/vs10/cogl-sdl-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.props b/build/win32/vs10/cogl.props new file mode 100644 index 0000000..9497f27 --- /dev/null +++ b/build/win32/vs10/cogl.props @@ -0,0 +1,297 @@ + + + + ..\..\..\..\vs10\$(Platform) + ..\..\..\vs10\$(Platform) + 1.0 + _WIN32_WINNT=0x0500;COGL_ENABLE_DEBUG + HAVE_CONFIG_H;CLUTTER_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="Cogl-Pango" + CLUTTER_COMPILATION;TESTS_DATADIR="../share/cogl-$(CoglApiVersion)/tests" + $(GlibEtcInstallRoot) + +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 + + +if exist ..\..\..\config.h goto DONE_CONFIG_H + +copy ..\..\..\config.h.win32 ..\..\..\config.h + +:DONE_CONFIG_H + + +cd .. + +gen-enums.bat $(GlibMkEnumsPath) + +cd .\vs10 + + + + +mkdir $(CopyDir) + +mkdir $(CopyDir)\bin + +copy $(SolutionDir)$(Configuration)\$(Platform)\bin\*.dll $(CopyDir)\bin + + +copy $(SolutionDir)$(Configuration)\$(Platform)\bin\*.exe $(CopyDir)\bin + + +copy ..\*.bat $(CopyDir)\bin + + +mkdir $(CopyDir)\share\cogl-$(CoglApiVersion)\examples-data + +copy ..\..\..\examples\*.jpg $(CopyDir)\share\cogl-$(CoglApiVersion)\examples-data + + +mkdir $(CopyDir)\lib + +copy $(SolutionDir)$(Configuration)\$(Platform)\bin\*-$(CoglApiVersion).lib $(CopyDir)\lib + + +mkdir $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +mkdir $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl-pango + +copy ..\..\..\cogl-pango\cogl-pango.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl-pango + +copy ..\..\..\cogl\cogl-object.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-attribute-buffer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-bitmap.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-buffer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-color.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-deprecated.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-depth-state.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-euler.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-fixed.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-glib-source.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-material-compat.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pipeline.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-vector.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-matrix.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-offscreen.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-onscreen.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-primitives.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-path.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-path-functions.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pipeline-layer-state.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pipeline-state.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-pixel-buffer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-poll.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-quaternion.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-shader.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-snippet.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-2d.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-2d-sliced.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-sub-texture.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-rectangle.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-meta-texture.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-texture-3d.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-types.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-vertex-buffer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-index-buffer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-indices.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-attribute.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-primitive.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-clip-state.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-framebuffer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-clutter.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-defines.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-enum-types.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + + +copy ..\..\..\cogl\cogl-renderer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-swap-chain.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-onscreen-template.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-display.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-context.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl-win32-renderer.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl1-context.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl2-path.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl2-experimental.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + +copy ..\..\..\cogl\cogl2-compatibility.h $(CopyDir)\include\cogl-$(CoglApiVersion)\cogl + + + + echo EXPORTS > ..\..\..\cogl\cogl.def + + cl -EP -D_COGL_SUPPORTS_GTYPE_INTEGRATION -DCOGL_HAS_WIN32_SUPPORT -DCOGL_HAS_GLIB_SUPPORT ..\..\..\cogl\cogl.symbols >> ..\..\..\cogl\cogl.def + + + + echo EXPORTS > ..\..\..\cogl-pango\cogl-pango.def + + cl -EP ..\..\..\cogl-pango\cogl-pango.symbols >> ..\..\..\cogl-pango\cogl-pango.def + + + lib + -$(CoglApiVersion)-0 + + -1-vs10 + $(CoglSeparateVS10DllPrefix) + $(CoglSeparateVS10DllSuffix) + + + <_PropertySheetDisplayName>coglprops + $(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;COGL_HAS_GLIB_SUPPORT;%(PreprocessorDefinitions) + msvc_recommended_pragmas.h;%(ForcedIncludeFiles) + 4819;%(DisableSpecificWarnings) + + + glib-2.0.lib;gobject-2.0.lib;%(AdditionalDependencies) + $(GlibEtcInstallRoot)\lib;%(AdditionalLibraryDirectories) + + + + + $(GlibEtcInstallRoot) + + + $(GlibMkEnumsPath) + + + $(CoglApiVersion) + + + $(BaseBuildDefines) + + + $(LibBuildDefines) + + + $(ReleaseLibBuildDefines) + + + $(DebugLibBuildDefines) + + + $(CoglBuildDefines) + + + $(CoglPangoBuildDefines) + + + $(TestProgDef) + + + $(DoDefinesSDL) + + + $(DoDefinesSDL) + + + $(PreBuildCmd) + + + $(CoglDoInstall) + + + $(GenerateCoglDef) + + + $(GenerateCoglPangoDef) + + + $(CoglLibtoolCompatibleDllPrefix) + + + $(CoglLibtoolCompatibleDllSuffix) + + + $(CoglSeparateVS10DllPrefix) + + + $(CoglSeparateVS10DllSuffix) + + + $(CoglDllPrefix) + + + $(CoglDllSuffix) + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl.sln b/build/win32/vs10/cogl.sln new file mode 100644 index 0000000..c411d2b --- /dev/null +++ b/build/win32/vs10/cogl.sln @@ -0,0 +1,96 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl", "cogl.vcxproj", "{F3A80987-5411-43DB-A23B-06F2076E1206}" +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-msaa", "cogl-msaa.vcxproj", "{44E864D4-8447-484D-9B16-D5405E0783CF}" +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|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|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 + {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 + {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 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|Win32.ActiveCfg = Debug|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|Win32.Build.0 = Debug|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|x64.ActiveCfg = Debug|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|x64.Build.0 = Debug|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|Win32.ActiveCfg = Release|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|Win32.Build.0 = Release|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|x64.ActiveCfg = Release|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|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 + {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 + {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 + {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 + 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..5e5f7fe --- /dev/null +++ b/build/win32/vs10/cogl.vcxproj @@ -0,0 +1,494 @@ + + + + + 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 + Unicode + true + + + DynamicLibrary + Unicode + true + + + DynamicLibrary + Unicode + + + DynamicLibrary + Unicode + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + Debug\$(Platform)\bin\ + true + true + Debug\$(Platform)\bin\ + false + false + Release\$(Platform)\bin\ + true + true + Release\$(Platform)\bin\ + + + + + $(DoDefines) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX86 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX86 + + + + + + $(DoDefines) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX64 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX64 + + + + + + $(DoDefines) + $(PreBuildCmd) + + + + MaxSpeed + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + MaxSpeed + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + $(DoDefines) + $(PreBuildCmd) + + + + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs10/cogl.vcxproj.filters b/build/win32/vs10/cogl.vcxproj.filters new file mode 100644 index 0000000..c5266d4 --- /dev/null +++ b/build/win32/vs10/cogl.vcxproj.filters @@ -0,0 +1,114 @@ + + + + + {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\Driver_GL + Sources\Driver_GL + + diff --git a/build/win32/vs10/cogl.vcxproj.filtersin b/build/win32/vs10/cogl.vcxproj.filtersin new file mode 100644 index 0000000..cb77de1 --- /dev/null +++ b/build/win32/vs10/cogl.vcxproj.filtersin @@ -0,0 +1,24 @@ + + + + + {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 +#include "cogl.vs10.sourcefiles.filters" + Sources\Driver_GL + Sources\Driver_GL + + \ No newline at end of file diff --git a/build/win32/vs10/cogl.vcxprojin b/build/win32/vs10/cogl.vcxprojin new file mode 100644 index 0000000..0ead854 --- /dev/null +++ b/build/win32/vs10/cogl.vcxprojin @@ -0,0 +1,404 @@ + + + + + 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 + Unicode + true + + + DynamicLibrary + Unicode + true + + + DynamicLibrary + Unicode + + + DynamicLibrary + Unicode + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + Debug\$(Platform)\bin\ + true + true + Debug\$(Platform)\bin\ + false + false + Release\$(Platform)\bin\ + true + true + Release\$(Platform)\bin\ + + + + + $(DoDefines) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX86 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX86 + + + + + + $(DoDefines) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX64 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + Disabled + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(DebugLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + MachineX64 + + + + + + $(DoDefines) + $(PreBuildCmd) + + + + MaxSpeed + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + MaxSpeed + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + true + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX86 + + + + + + $(DoDefines) + $(PreBuildCmd) + + + + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + $(DoDefinesSDL) + $(PreBuildCmd) + + + + ..\..\..\cogl\tesselator;..\..\..\cogl\winsys;..\..\..\cogl\driver\gl;%(AdditionalIncludeDirectories) + $(ReleaseLibBuildDefines);$(CoglBuildDefines);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + $(GenerateCoglDef) + + + SDL.lib;opengl32.lib;intl.lib;cairo.lib;gdk_pixbuf-2.0.lib;gmodule-2.0.lib;%(AdditionalDependencies) + $(OutDir)$(CoglDllPrefix)$(ProjectName)$(CoglDllSuffix).dll + ..\..\..\cogl\cogl.def + $(TargetDir)$(ProjectName)-$(CoglApiVersion).lib + true + Windows + true + true + MachineX64 + + + + + + true + true + true + true + + +#include "cogl.vs10.sourcefiles" + + + + + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/cogl_sdl.sln b/build/win32/vs10/cogl_sdl.sln new file mode 100644 index 0000000..c20e8f9 --- /dev/null +++ b/build/win32/vs10/cogl_sdl.sln @@ -0,0 +1,96 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cogl", "cogl.vcxproj", "{F3A80987-5411-43DB-A23B-06F2076E1206}" +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-sdl-hello", "cogl-sdl-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-sdl", "install-sdl.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|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.ActiveCfg = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.Build.0 = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.ActiveCfg = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.Build.0 = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.ActiveCfg = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.Build.0 = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.ActiveCfg = Release_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.Build.0 = Release_SDL|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 + {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 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|Win32.ActiveCfg = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|Win32.Build.0 = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|x64.ActiveCfg = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|x64.Build.0 = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|Win32.ActiveCfg = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|Win32.Build.0 = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|x64.ActiveCfg = Release|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|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 + {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 + {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 + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/win32/vs10/install-sdl.vcxproj b/build/win32/vs10/install-sdl.vcxproj new file mode 100644 index 0000000..7b21b02 --- /dev/null +++ b/build/win32/vs10/install-sdl.vcxproj @@ -0,0 +1,125 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {35B2A4AC-7235-4FC7-995D-469D59195041} + install + + + + Utility + MultiByte + true + + + Utility + MultiByte + + + Utility + MultiByte + true + + + Utility + MultiByte + + + + + + + + + + + + + + + + + + + + + + + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + + + + + $(CoglDoInstall) + + + + + $(CoglDoInstall) + + + + + $(CoglDoInstall) + + + + + $(CoglDoInstall) + + + + + {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-06f2076e1206} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/install.vcxproj b/build/win32/vs10/install.vcxproj new file mode 100644 index 0000000..5c4708a --- /dev/null +++ b/build/win32/vs10/install.vcxproj @@ -0,0 +1,125 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {35B2A4AC-7235-4FC7-995D-469D59195041} + install + + + + Utility + MultiByte + true + + + Utility + MultiByte + + + Utility + MultiByte + true + + + Utility + MultiByte + + + + + + + + + + + + + + + + + + + + + + + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + + $(GlibEtcInstallRoot)\ + $(GlibEtcInstallRoot)\ + + + + + $(CoglDoInstall) + + + + + $(CoglDoInstall) + + + + + $(CoglDoInstall) + + + + + $(CoglDoInstall) + + + + + {0f08f253-de1a-40cb-a890-93ae3ca23ade} + false + + + {de1a2710-04bb-4c3d-90c1-b070e326b1cf} + false + + + {f5a43c12-7032-428e-a56a-d294075fa493} + false + + + {44e864d4-8447-484d-9b16-d5405e0783cf} + false + + + {cd17f5c8-c860-4a65-8209-4d0b093a3da3} + false + + + {fe5abd0f-91e8-4aa5-9c1c-408427d5f768} + false + + + {f3a80987-5411-43db-a23b-06f2076e1206} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs10/test-conformance-cogl.vcxproj b/build/win32/vs10/test-conformance-cogl.vcxproj new file mode 100644 index 0000000..dcb514b --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxproj @@ -0,0 +1,195 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE} + testconformancecogl + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + %(AdditionalDependencies) + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {ea036190-0950-4640-84f9-d459a33b33a8} + 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..4940089 --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {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 + + 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..8028da3 --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin @@ -0,0 +1,12 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + +#include "testconformance.vs10.sourcefiles.filters" + + \ No newline at end of file diff --git a/build/win32/vs10/test-conformance-cogl.vcxprojin b/build/win32/vs10/test-conformance-cogl.vcxprojin new file mode 100644 index 0000000..b7d91f2 --- /dev/null +++ b/build/win32/vs10/test-conformance-cogl.vcxprojin @@ -0,0 +1,172 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0F08F253-DE1A-40CB-A890-93AE3CA23ADE} + testconformancecogl + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + true + true + false + false + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + %(AdditionalDependencies) + true + Console + MachineX86 + + + + + Disabled + _DEBUG;COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + false + + + MachineX64 + + + + + MaxSpeed + true + COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + COGL_ENABLE_EXPERIMENTAL_API;$(TestProgDef);%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + CompileAsC + + + %(AdditionalDependencies) + true + Console + true + true + false + + + MachineX64 + + + +#include "testconformance.vs10.sourcefiles" + + + + {ea036190-0950-4640-84f9-d459a33b33a8} + false + + + {fe5abd0f-91e8-4aa5-9c1c-408427d5f768} + false + + + + + + \ No newline at end of file diff --git a/build/win32/vs9/Makefile.am b/build/win32/vs9/Makefile.am new file mode 100644 index 0000000..56296cf --- /dev/null +++ b/build/win32/vs9/Makefile.am @@ -0,0 +1,17 @@ +EXTRA_DIST = \ + cogl.sln \ + cogl_sdl.sln \ + cogl.vsprops \ + cogl.vcproj \ + cogl.vcprojin \ + cogl-pango.vcproj \ + cogl-pango.vcprojin \ + test-conformance-cogl.vcproj \ + test-conformance-cogl.vcprojin \ + cogl-hello.vcproj \ + cogl-sdl-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..4211abe --- /dev/null +++ b/build/win32/vs9/Makefile.in @@ -0,0 +1,482 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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_sdl.sln \ + cogl.vsprops \ + cogl.vcproj \ + cogl.vcprojin \ + cogl-pango.vcproj \ + cogl-pango.vcprojin \ + test-conformance-cogl.vcproj \ + test-conformance-cogl.vcprojin \ + cogl-hello.vcproj \ + cogl-sdl-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 +TAGS: + +ctags: CTAGS +CTAGS: + + +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 \ + 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 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..4c4b45a --- /dev/null +++ b/build/win32/vs9/README.txt @@ -0,0 +1,79 @@ +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. + +Decide whether you want to build the SDL winsys with your COGL build, and +use one of the .sln for building COGL (note that both will build the Windows +OpenGL (WGL) winsys): +-cogl.sln for building COGL without the SDL winsys +-cogl_sdl.sln for building COGL with the SDL winsys + +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). + +If building the SDL winsys is desired, you will also need the SDL libraries +from www.libsdl.org-building the SDL source package with Visual C++ 2008 +is recommended (working Visual C++ 2005 projects are included with it, upgrade +the projects one prompted), but one may want to use the VC8 binary packages +from that website. + +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 +-(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) 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 + (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) + +--Chun-wei Fan + (Adopted from the GTK+ Win32 VS README.txt file originally by Tor Lillqvist) diff --git a/build/win32/vs9/cogl-crate.vcproj b/build/win32/vs9/cogl-crate.vcproj new file mode 100644 index 0000000..e4bdedb --- /dev/null +++ b/build/win32/vs9/cogl-crate.vcproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-hello.vcproj b/build/win32/vs9/cogl-hello.vcproj new file mode 100644 index 0000000..cc58e9a --- /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..b869263 --- /dev/null +++ b/build/win32/vs9/cogl-info.vcproj @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-msaa.vcproj b/build/win32/vs9/cogl-msaa.vcproj new file mode 100644 index 0000000..61dc109 --- /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..6a22fec --- /dev/null +++ b/build/win32/vs9/cogl-pango.vcproj @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl-pango.vcprojin b/build/win32/vs9/cogl-pango.vcprojin new file mode 100644 index 0000000..7469863 --- /dev/null +++ b/build/win32/vs9/cogl-pango.vcprojin @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#include "coglpango.sourcefiles" + + + + + + + + + + diff --git a/build/win32/vs9/cogl-sdl-hello.vcproj b/build/win32/vs9/cogl-sdl-hello.vcproj new file mode 100644 index 0000000..788a677 --- /dev/null +++ b/build/win32/vs9/cogl-sdl-hello.vcproj @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl.sln b/build/win32/vs9/cogl.sln new file mode 100644 index 0000000..32bc814 --- /dev/null +++ b/build/win32/vs9/cogl.sln @@ -0,0 +1,125 @@ + +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-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-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-msaa", "cogl-msaa.vcproj", "{44E864D4-8447-484D-9B16-D5405E0783CF}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + 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} + 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} + {44E864D4-8447-484D-9B16-D5405E0783CF} = {44E864D4-8447-484D-9B16-D5405E0783CF} + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} = {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + {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|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|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 + {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 + {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 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|Win32.ActiveCfg = Debug|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|Win32.Build.0 = Debug|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|x64.ActiveCfg = Debug|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|x64.Build.0 = Debug|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|Win32.ActiveCfg = Release|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|Win32.Build.0 = Release|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|x64.ActiveCfg = Release|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|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 + {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 + {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 + {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 + 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..33fc8b7 --- /dev/null +++ b/build/win32/vs9/cogl.vcproj @@ -0,0 +1,481 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl.vcprojin b/build/win32/vs9/cogl.vcprojin new file mode 100644 index 0000000..8a8cb82 --- /dev/null +++ b/build/win32/vs9/cogl.vcprojin @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#include "cogl.sourcefiles" + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl.vsprops b/build/win32/vs9/cogl.vsprops new file mode 100644 index 0000000..ef4de04 --- /dev/null +++ b/build/win32/vs9/cogl.vsprops @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/cogl_sdl.sln b/build/win32/vs9/cogl_sdl.sln new file mode 100644 index 0000000..c1eeaab --- /dev/null +++ b/build/win32/vs9/cogl_sdl.sln @@ -0,0 +1,139 @@ + +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-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-sdl-hello", "cogl-sdl-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-msaa", "cogl-msaa.vcproj", "{44E864D4-8447-484D-9B16-D5405E0783CF}" + ProjectSection(ProjectDependencies) = postProject + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + 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} + 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} + {44E864D4-8447-484D-9B16-D5405E0783CF} = {44E864D4-8447-484D-9B16-D5405E0783CF} + {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} = {CD17F5C8-C860-4A65-8209-4D0B093A3DA3} + {F3A80987-5411-43DB-A23B-06F2076E1206} = {F3A80987-5411-43DB-A23B-06F2076E1206} + {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|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.ActiveCfg = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|Win32.Build.0 = Debug_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.ActiveCfg = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Debug|x64.Build.0 = Debug_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.ActiveCfg = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|Win32.Build.0 = Release_SDL|Win32 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.ActiveCfg = Release_SDL|x64 + {F3A80987-5411-43DB-A23B-06F2076E1206}.Release|x64.Build.0 = Release_SDL|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 + {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 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|Win32.ActiveCfg = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|Win32.Build.0 = Debug|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|x64.ActiveCfg = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Debug|x64.Build.0 = Debug|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|Win32.ActiveCfg = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|Win32.Build.0 = Release|Win32 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|x64.ActiveCfg = Release|x64 + {0B5D144D-1872-42CD-8437-FFDCDD08C03E}.Release|x64.Build.0 = Release|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|Win32.ActiveCfg = Debug|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|Win32.Build.0 = Debug|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|x64.ActiveCfg = Debug|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Debug|x64.Build.0 = Debug|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|Win32.ActiveCfg = Release|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|Win32.Build.0 = Release|Win32 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|x64.ActiveCfg = Release|x64 + {44E864D4-8447-484D-9B16-D5405E0783CF}.Release|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 + {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 + {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 + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/win32/vs9/install.vcproj b/build/win32/vs9/install.vcproj new file mode 100644 index 0000000..f2e013d --- /dev/null +++ b/build/win32/vs9/install.vcproj @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/test-conformance-cogl.vcproj b/build/win32/vs9/test-conformance-cogl.vcproj new file mode 100644 index 0000000..6466164 --- /dev/null +++ b/build/win32/vs9/test-conformance-cogl.vcproj @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/win32/vs9/test-conformance-cogl.vcprojin b/build/win32/vs9/test-conformance-cogl.vcprojin new file mode 100644 index 0000000..6983027 --- /dev/null +++ b/build/win32/vs9/test-conformance-cogl.vcprojin @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#include "testconformance.sourcefiles" + + + + + diff --git a/cogl-pango/Makefile.am b/cogl-pango/Makefile.am new file mode 100644 index 0000000..b49562f --- /dev/null +++ b/cogl-pango/Makefile.am @@ -0,0 +1,128 @@ +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@ + +INCLUDES = \ + -DCLUTTER_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 = $(INCLUDES) $(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 + +INTROSPECTION_GIRS += CoglPango-1.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..2f1cda3 --- /dev/null +++ b/cogl-pango/Makefile.in @@ -0,0 +1,930 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = $(cogl_pangoheaders_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/cogl-pango-1.0.pc.in \ + $(srcdir)/cogl-pango-2.0-experimental.pc.in \ + $(srcdir)/cogl-pango.rc.in \ + $(top_srcdir)/build/autotools/Makefile.am.silent +@HAVE_INTROSPECTION_TRUE@am__append_1 = CoglPango-1.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/as-compiler-flag.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/introspection.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__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_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +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 $@ +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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libcogl_pango_la_SOURCES) +DIST_SOURCES = $(libcogl_pango_la_SOURCES) +DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) +HEADERS = $(cogl_pangoheaders_HEADERS) +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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_.*" + +INCLUDES = \ + -DCLUTTER_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 = $(INCLUDES) $(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@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_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) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcogl-pango.la: $(libcogl_pango_la_OBJECTS) $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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) + test -z "$(girdir)" || $(MKDIR_P) "$(DESTDIR)$(girdir)" + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(girdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(girdir)" && rm -f $$files +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files +install-typelibDATA: $(typelib_DATA) + @$(NORMAL_INSTALL) + test -z "$(typelibdir)" || $(MKDIR_P) "$(DESTDIR)$(typelibdir)" + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(typelibdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(typelibdir)" && rm -f $$files +install-cogl_pangoheadersHEADERS: $(cogl_pangoheaders_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(cogl_pangoheadersdir)" || $(MKDIR_P) "$(DESTDIR)$(cogl_pangoheadersdir)" + @list='$(cogl_pangoheaders_HEADERS)'; test -n "$(cogl_pangoheadersdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(cogl_pangoheadersdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(cogl_pangoheadersdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags 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 uninstall uninstall-am \ + uninstall-cogl_pangoheadersHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-typelibDATA + + -no-undefined \ + -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ + +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 + +# 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..0f5d982 --- /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=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} -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..6800c6c --- /dev/null +++ b/cogl-pango/cogl-pango-display-list.c @@ -0,0 +1,496 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Neil Roberts + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "cogl-pango-display-list.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 +{ + gboolean 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; + + gboolean 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 + { + float y_1; + float x_11; + float x_21; + float y_2; + float x_12; + float x_22; + } 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) +{ + CoglPangoDisplayListNode *node = g_slice_new (CoglPangoDisplayListNode); + + node->type = COGL_PANGO_DISPLAY_LIST_TRAPEZOID; + node->color_override = dl->color_override; + node->color = dl->color; + node->d.trapezoid.y_1 = y_1; + node->d.trapezoid.x_11 = x_11; + node->d.trapezoid.x_21 = x_21; + node->d.trapezoid.y_2 = y_2; + node->d.trapezoid.x_12 = x_12; + node->d.trapezoid.x_22 = x_22; + node->pipeline = NULL; + + _cogl_pango_display_list_append_node (dl, node); +} + +static void +emit_rectangles_through_journal (CoglPangoDisplayListNode *node) +{ + cogl_rectangles_with_texture_coords ((float *) + node->d.texture.rectangles->data, + node->d.texture.rectangles->len); +} + +static void +emit_vertex_buffer_geometry (CoglPangoDisplayListNode *node) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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; + gboolean allocated = FALSE; + CoglAttribute *attributes[2]; + CoglPrimitive *prim; + int i; + + n_verts = node->d.texture.rectangles->len * 4; + + buffer + = cogl_attribute_buffer_new (ctx, + n_verts * sizeof (CoglVertexP2T2), NULL); + + 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 (ctx->driver == COGL_DRIVER_GL) + 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_framebuffer_draw_primitive (cogl_get_draw_framebuffer (), + cogl_get_source (), + node->d.texture.primitive); +} + +static void +_cogl_pango_display_list_render_texture (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 (node); + else + emit_vertex_buffer_geometry (node); +} + +void +_cogl_pango_display_list_render (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); + cogl_push_source (node->pipeline); + + switch (node->type) + { + case COGL_PANGO_DISPLAY_LIST_TEXTURE: + _cogl_pango_display_list_render_texture (node); + break; + + case COGL_PANGO_DISPLAY_LIST_RECTANGLE: + cogl_rectangle (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: + { + float points[8]; + CoglPath *path; + + points[0] = node->d.trapezoid.x_11; + points[1] = node->d.trapezoid.y_1; + points[2] = node->d.trapezoid.x_12; + points[3] = node->d.trapezoid.y_2; + points[4] = node->d.trapezoid.x_22; + points[5] = node->d.trapezoid.y_2; + points[6] = node->d.trapezoid.x_21; + points[7] = node->d.trapezoid.y_1; + + path = cogl_path_new (); + cogl_path_polygon (path, points, 4); + cogl_path_fill (path); + cogl_object_unref (path); + } + break; + } + + cogl_pop_source (); + } +} + +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); + } + + 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..f98dbc8 --- /dev/null +++ b/cogl-pango/cogl-pango-display-list.h @@ -0,0 +1,69 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Neil Roberts + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + */ + +#ifndef __COGL_PANGO_DISPLAY_LIST_H__ +#define __COGL_PANGO_DISPLAY_LIST_H__ + +#include +#include +#include "cogl-pango-pipeline-cache.h" + +G_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 (CoglPangoDisplayList *dl, + const CoglColor *color); + +void _cogl_pango_display_list_clear (CoglPangoDisplayList *dl); + +void _cogl_pango_display_list_free (CoglPangoDisplayList *dl); + +G_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..860f237 --- /dev/null +++ b/cogl-pango/cogl-pango-fontmap.c @@ -0,0 +1,209 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2008 OpenedHand + * + * 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, see . + */ + +/** + * 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" + +static GQuark cogl_pango_font_map_get_renderer_key (void) G_GNUC_CONST; + +/** + * cogl_pango_font_map_new: + * + * Creates a new font map. + * + * Return value: (transfer full): the newly created #PangoFontMap + * + * Since: 1.0 + */ +PangoFontMap * +cogl_pango_font_map_new (void) +{ + return pango_cairo_font_map_new (); +} + +/** + * cogl_pango_font_map_create_context: + * @fm: a #CoglPangoFontMap + * + * Creates a new #PangoContext from the passed font map. + * + * Return value: (transfer full): the newly created #PangoContext + * + * Since: 1.0 + */ +PangoContext * +cogl_pango_font_map_create_context (CoglPangoFontMap *fm) +{ + g_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)); +} + +/** + * cogl_pango_font_map_get_renderer: + * @fm: 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 *fm) +{ + PangoRenderer *renderer; + + g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (fm), NULL); + + /* We want to keep a cached pointer to the renderer from the font + map instance but as we don't have a proper subclass we have to + store it in the object data instead */ + + renderer = g_object_get_qdata (G_OBJECT (fm), + cogl_pango_font_map_get_renderer_key ()); + + if (G_UNLIKELY (renderer == NULL)) + { + renderer = g_object_new (COGL_PANGO_TYPE_RENDERER, NULL); + g_object_set_qdata_full (G_OBJECT (fm), + cogl_pango_font_map_get_renderer_key (), + renderer, + g_object_unref); + } + + return renderer; +} + +/** + * cogl_pango_font_map_set_resolution: + * @font_map: a #CoglPangoFontMap + * @dpi: DPI to set + * + * Sets the resolution to be used by @font_map at @dpi. + * + * Since: 1.0 + */ +void +cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map, + double dpi) +{ + g_return_if_fail (COGL_PANGO_IS_FONT_MAP (font_map)); + + pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (font_map), dpi); +} + +/** + * cogl_pango_font_map_clear_glyph_cache: + * @fm: a #CoglPangoFontMap + * + * Clears the glyph cache for @fm. + * + * Since: 1.0 + */ +void +cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *fm) +{ + PangoRenderer *renderer; + + renderer = cogl_pango_font_map_get_renderer (fm); + + _cogl_pango_renderer_clear_glyph_cache (COGL_PANGO_RENDERER (renderer)); +} + +/** + * cogl_pango_font_map_set_use_mipmapping: + * @fm: 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 *fm, + gboolean value) +{ + CoglPangoRenderer *renderer; + + renderer = COGL_PANGO_RENDERER (cogl_pango_font_map_get_renderer (fm)); + + _cogl_pango_renderer_set_use_mipmapping (renderer, value); +} + +/** + * cogl_pango_font_map_get_use_mipmapping: + * @fm: a #CoglPangoFontMap + * + * Retrieves whether the #CoglPangoRenderer used by @fm will + * use mipmapping when rendering the glyphs. + * + * Return value: %TRUE if mipmapping is used, %FALSE otherwise. + * + * Since: 1.0 + */ +gboolean +cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *fm) +{ + CoglPangoRenderer *renderer; + + renderer = COGL_PANGO_RENDERER (cogl_pango_font_map_get_renderer (fm)); + + return _cogl_pango_renderer_get_use_mipmapping (renderer); +} + +static GQuark +cogl_pango_font_map_get_renderer_key (void) +{ + static GQuark renderer_key = 0; + + if (G_UNLIKELY (renderer_key == 0)) + renderer_key = g_quark_from_static_string ("CoglPangoFontMap"); + + return renderer_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..5ddb4ac --- /dev/null +++ b/cogl-pango/cogl-pango-glyph-cache.c @@ -0,0 +1,416 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2008 OpenedHand + * + * 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, see . + */ + +#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 +{ + /* 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 */ + gboolean 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 */ + gboolean 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 */ + gboolean 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 guint +cogl_pango_glyph_cache_hash_func (gconstpointer 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 gboolean +cogl_pango_glyph_cache_equal_func (gconstpointer a, + gconstpointer 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 (gboolean use_mipmapping) +{ + CoglPangoGlyphCache *cache; + + cache = g_malloc (sizeof (CoglPangoGlyphCache)); + + 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 + (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, + CoglHandle 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 gboolean +cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache, + PangoFont *font, + PangoGlyph glyph, + CoglPangoGlyphCacheValue *value) +{ + CoglTexture *texture; + + 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 (value->draw_width, + value->draw_height, + COGL_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE); + + if (texture == NULL) + return FALSE; + + value->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 + (cogl_pango_glyph_cache_reorganize_cb, cache); + cache->using_global_atlas = TRUE; + } + + return TRUE; +} + +static gboolean +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, + gboolean 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 (gpointer key_ptr, + gpointer value_ptr, + gpointer 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..df6b632 --- /dev/null +++ b/cogl-pango/cogl-pango-glyph-cache.h @@ -0,0 +1,93 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2008 OpenedHand + * + * 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, see . + */ + +#ifndef __COGL_PANGO_GLYPH_CACHE_H__ +#define __COGL_PANGO_GLYPH_CACHE_H__ + +#include +#include +#include + +G_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 */ + gboolean dirty; +}; + +typedef void (* CoglPangoGlyphCacheDirtyFunc) (PangoFont *font, + PangoGlyph glyph, + CoglPangoGlyphCacheValue *value); + +CoglPangoGlyphCache * +cogl_pango_glyph_cache_new (gboolean use_mipmapping); + +void +cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache); + +CoglPangoGlyphCacheValue * +cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache, + gboolean 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); + +G_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..5a2e2ec --- /dev/null +++ b/cogl-pango/cogl-pango-pipeline-cache.c @@ -0,0 +1,244 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include "cogl-pango-pipeline-cache.h" + +#include "cogl/cogl-context-private.h" + +typedef struct _CoglPangoPipelineCacheEntry CoglPangoPipelineCacheEntry; + +struct _CoglPangoPipelineCache +{ + GHashTable *hash_table; + + CoglPipeline *base_texture_alpha_pipeline; + CoglPipeline *base_texture_rgba_pipeline; + + gboolean use_mipmapping; +}; + +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 */ + CoglHandle pipeline; +}; + +static void +_cogl_pango_pipeline_cache_key_destroy (gpointer data) +{ + if (data) + cogl_object_unref (data); +} + +static void +_cogl_pango_pipeline_cache_value_destroy (gpointer 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 (gboolean use_mipmapping) +{ + CoglPangoPipelineCache *cache = g_new (CoglPangoPipelineCache, 1); + + /* 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; + + _COGL_GET_CONTEXT (ctx, NULL); + + pipeline = cache->base_texture_rgba_pipeline = cogl_pipeline_new (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, + CoglHandle 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 + { + _COGL_GET_CONTEXT (ctx, NULL); + + entry->texture = NULL; + entry->pipeline = cogl_pipeline_new (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 (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); + + 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..d095c58 --- /dev/null +++ b/cogl-pango/cogl-pango-pipeline-cache.h @@ -0,0 +1,53 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PANGO_PIPELINE_CACHE_H__ +#define __COGL_PANGO_PIPELINE_CACHE_H__ + +#include +#include + +G_BEGIN_DECLS + +typedef struct _CoglPangoPipelineCache CoglPangoPipelineCache; + +CoglPangoPipelineCache * +_cogl_pango_pipeline_cache_new (gboolean 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, + CoglHandle texture); + +void +_cogl_pango_pipeline_cache_free (CoglPangoPipelineCache *cache); + +G_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..447e853 --- /dev/null +++ b/cogl-pango/cogl-pango-private.h @@ -0,0 +1,38 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2008 OpenedHand + * + * 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, see . + */ + +#ifndef __COGL_PANGO_PRIVATE_H__ +#define __COGL_PANGO_PRIVATE_H__ + +#include "cogl-pango.h" + +G_BEGIN_DECLS + +void _cogl_pango_renderer_clear_glyph_cache (CoglPangoRenderer *renderer); +void _cogl_pango_renderer_set_use_mipmapping (CoglPangoRenderer *renderer, + gboolean value); +gboolean _cogl_pango_renderer_get_use_mipmapping (CoglPangoRenderer *renderer); + +G_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..dccaa15 --- /dev/null +++ b/cogl-pango/cogl-pango-render.c @@ -0,0 +1,849 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2008 OpenedHand + * + * 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, see . + */ + +#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" + +typedef struct +{ + CoglPangoGlyphCache *glyph_cache; + CoglPangoPipelineCache *pipeline_cache; +} CoglPangoRendererCaches; + +struct _CoglPangoRenderer +{ + PangoRenderer parent_instance; + + /* 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; + + gboolean use_mipmapping; + + /* The current display list that is being built */ + CoglPangoDisplayList *display_list; +}; + +struct _CoglPangoRendererClass +{ + PangoRendererClass class_instance; +}; + +typedef struct _CoglPangoRendererQdata CoglPangoRendererQdata; + +/* An instance of this struct gets attached to each PangoLayout to + cache the VBO and to detect changes to the layout */ +struct _CoglPangoRendererQdata +{ + 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 */ + gboolean 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; + +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; + + g_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_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) +{ + priv->no_mipmap_caches.pipeline_cache = + _cogl_pango_pipeline_cache_new (FALSE); + priv->mipmap_caches.pipeline_cache = + _cogl_pango_pipeline_cache_new (TRUE); + + priv->no_mipmap_caches.glyph_cache = cogl_pango_glyph_cache_new (FALSE); + priv->mipmap_caches.glyph_cache = cogl_pango_glyph_cache_new (TRUE); + + _cogl_pango_renderer_set_use_mipmapping (priv, FALSE); +} + +static void +cogl_pango_renderer_class_init (CoglPangoRendererClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass); + + object_class->finalize = cogl_pango_renderer_finalize; + + 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_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; + PangoRenderer *renderer; + CoglPangoFontMap *font_map_priv; + + font_map = pango_context_get_font_map (context); + g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (font_map), NULL); + + font_map_priv = COGL_PANGO_FONT_MAP (font_map); + renderer = cogl_pango_font_map_get_renderer (font_map_priv); + g_return_val_if_fail (COGL_PANGO_IS_RENDERER (renderer), NULL); + + return COGL_PANGO_RENDERER (renderer); +} + +static GQuark +cogl_pango_render_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_render_qdata_forget_display_list (CoglPangoRendererQdata *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_render_qdata_forget_display_list, + qdata); + + _cogl_pango_display_list_free (qdata->display_list); + + qdata->display_list = NULL; + } +} + +static void +cogl_pango_render_qdata_destroy (CoglPangoRendererQdata *qdata) +{ + cogl_pango_render_qdata_forget_display_list (qdata); + if (qdata->first_line) + pango_layout_line_unref (qdata->first_line); + g_slice_free (CoglPangoRendererQdata, qdata); +} + +/** + * cogl_pango_render_layout_subpixel: + * @layout: a #PangoLayout + * @x: FIXME + * @y: FIXME + * @color: color to use when rendering the layout + * @flags: flags to pass to the renderer + * + * FIXME + * + * Since: 1.0 + */ +void +cogl_pango_render_layout_subpixel (PangoLayout *layout, + int x, + int y, + const CoglColor *color, + int flags) +{ + PangoContext *context; + CoglPangoRenderer *priv; + CoglPangoRendererQdata *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_render_get_qdata_key ()); + + if (qdata == NULL) + { + qdata = g_slice_new0 (CoglPangoRendererQdata); + qdata->renderer = priv; + g_object_set_qdata_full (G_OBJECT (layout), + cogl_pango_render_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_render_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_render_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_push_matrix (); + cogl_translate (x / (gfloat) PANGO_SCALE, y / (gfloat) PANGO_SCALE, 0); + _cogl_pango_display_list_render (qdata->display_list, + color); + cogl_pop_matrix (); + + /* 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); + } +} + +/** + * 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: flags to pass to the renderer + * + * Renders @layout. + * + * Since: 1.0 + */ +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); +} + +/** + * 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 + */ +void +cogl_pango_render_layout_line (PangoLayoutLine *line, + int x, + int y, + const CoglColor *color) +{ + PangoContext *context; + CoglPangoRenderer *priv; + CoglPangoRendererCaches *caches; + + 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, x, y); + + _cogl_pango_display_list_render (priv->display_list, + color); + + _cogl_pango_display_list_free (priv->display_list); + priv->display_list = NULL; +} + +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, + gboolean value) +{ + renderer->use_mipmapping = value; +} + +gboolean +_cogl_pango_renderer_get_use_mipmapping (CoglPangoRenderer *renderer) +{ + return renderer->use_mipmapping; +} + +static CoglPangoGlyphCacheValue * +cogl_pango_renderer_get_cached_glyph (PangoRenderer *renderer, + gboolean 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 */ + g_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); + + g_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); + + g_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; + + g_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); + float points[8]; + + g_return_if_fail (priv->display_list != NULL); + + points[0] = (x11); + points[1] = (y1); + points[2] = (x12); + points[3] = (y2); + points[4] = (x22); + points[5] = points[3]; + points[6] = (x21); + points[7] = points[1]; + + 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..8e7165d --- /dev/null +++ b/cogl-pango/cogl-pango.h @@ -0,0 +1,85 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2008 OpenedHand + * + * 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, see . + */ + +#ifndef __PANGO_CLUTTER_H__ +#define __PANGO_CLUTTER_H__ + +#include +#include +#include +#include + +G_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; + +PangoFontMap * cogl_pango_font_map_new (void); +PangoContext * cogl_pango_font_map_create_context (CoglPangoFontMap *fm); +void cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map, + double dpi); +void cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *fm); +void cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout); +void cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *fm, + gboolean value); +gboolean cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *fm); +PangoRenderer *cogl_pango_font_map_get_renderer (CoglPangoFontMap *fm); + +#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; + +void cogl_pango_render_layout_subpixel (PangoLayout *layout, + int x, + int y, + const CoglColor *color, + int flags); +void cogl_pango_render_layout (PangoLayout *layout, + int x, + int y, + const CoglColor *color, + int flags); +void cogl_pango_render_layout_line (PangoLayoutLine *line, + int x, + int y, + const CoglColor *color); + +G_END_DECLS + +#endif /* __PANGO_CLUTTER_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..c01037d --- /dev/null +++ b/cogl-pango/cogl-pango.rc @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,10,2,0 + PRODUCTVERSION 1,10,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.10.2.0" + VALUE "InternalName", "libcogl-pango-1.0-1" + VALUE "LegalCopyright", "Copyright 1995-2011 © Intel Corporation" + VALUE "OriginalFilename", "libcogl-pango-1.0-1.dll" + VALUE "ProductName", "cogl-pango" + VALUE "ProductVersion", "1.10.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/Makefile.am b/cogl/Makefile.am new file mode 100644 index 0000000..f6dbb0d --- /dev/null +++ b/cogl/Makefile.am @@ -0,0 +1,595 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +# preamble + +NULL = + +SUBDIRS = + +BUILT_SOURCES = + +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = + +noinst_LTLIBRARIES = +lib_LTLIBRARIES = + +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + -I$(srcdir)/tesselator \ + -I$(srcdir)/winsys \ + -I$(srcdir)/driver/$(COGL_DRIVER) \ + $(NULL) + +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"Cogl\" \ + -DCLUTTER_COMPILATION \ + -DCOGL_GL_LIBNAME=\"$(COGL_GL_LIBNAME)\" \ + -DCOGL_GLES1_LIBNAME=\"$(COGL_GLES1_LIBNAME)\" \ + -DCOGL_GLES2_LIBNAME=\"$(COGL_GLES2_LIBNAME)\" \ + -DCOGL_LOCALEDIR=\""$(localedir)"\" \ + $(NULL) + +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) + +BUILT_SOURCES += cogl-defines.h +DISTCLEANFILES += cogl-defines.h +EXTRA_DIST += cogl-defines.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) + +# public 1.x api headers +cogl_1_public_h = \ + $(srcdir)/cogl1-context.h \ + $(srcdir)/cogl-bitmap.h \ + $(srcdir)/cogl-color.h \ + $(srcdir)/cogl-fixed.h \ + $(srcdir)/cogl-material-compat.h \ + $(srcdir)/cogl-matrix.h \ + $(srcdir)/cogl-offscreen.h \ + $(srcdir)/cogl-primitives.h \ + $(srcdir)/cogl-path.h \ + $(srcdir)/cogl-path-functions.h \ + $(srcdir)/cogl-shader.h \ + $(srcdir)/cogl-texture.h \ + $(srcdir)/cogl-types.h \ + $(srcdir)/cogl-vertex-buffer.h \ + $(srcdir)/cogl-clutter.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)/cogl2-path.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-clip-state.h \ + $(srcdir)/cogl-framebuffer.h \ + $(srcdir)/cogl-onscreen.h \ + $(srcdir)/cogl-vector.h \ + $(srcdir)/cogl-euler.h \ + $(srcdir)/cogl-quaternion.h \ + $(srcdir)/cogl-poll.h \ + $(srcdir)/cogl-texture-3d.h \ + $(srcdir)/cogl-texture-2d.h \ + $(srcdir)/cogl-texture-rectangle.h \ + $(srcdir)/cogl-texture-2d-sliced.h \ + $(srcdir)/cogl-sub-texture.h \ + $(srcdir)/cogl-meta-texture.h \ + $(srcdir)/cogl-depth-state.h \ + $(srcdir)/cogl-buffer.h \ + $(srcdir)/cogl-pixel-buffer.h \ + $(srcdir)/cogl2-experimental.h \ + $(srcdir)/cogl2-compatibility.h \ + $(NULL) + +# driver sources +cogl_driver_sources = + +if COGL_DRIVER_GL_SUPPORTED +cogl_driver_sources += \ + $(srcdir)/driver/gl/cogl-gl.c \ + $(srcdir)/driver/gl/cogl-texture-driver-gl.c \ + $(NULL) +endif + +if COGL_DRIVER_GLES_SUPPORTED +cogl_driver_sources += \ + $(srcdir)/driver/gles/cogl-gles.c \ + $(srcdir)/driver/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) + +# 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) + +EXTRA_DIST += \ + $(srcdir)/tesselator/README \ + $(srcdir)/tesselator/priorityq-heap.c \ + $(NULL) + +# sources +cogl_sources_c = \ + $(cogl_driver_sources) \ + $(cogl_winsys_common_sources) \ + $(cogl_tesselator_sources) \ + $(srcdir)/cogl-private.h \ + $(srcdir)/cogl-debug.h \ + $(srcdir)/cogl-debug-options.h \ + $(srcdir)/cogl-handle.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-internal.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-path-private.h \ + $(srcdir)/cogl-path.h \ + $(srcdir)/cogl-path.c \ + $(srcdir)/cogl2-path.h \ + $(srcdir)/cogl2-path.c \ + $(srcdir)/cogl-bitmap-pixbuf.c \ + $(srcdir)/cogl-clip-stack.h \ + $(srcdir)/cogl-clip-stack.c \ + $(srcdir)/cogl-clip-state-private.h \ + $(srcdir)/cogl-clip-state.h \ + $(srcdir)/cogl-clip-state.c \ + $(srcdir)/cogl2-compatibility.c \ + $(srcdir)/cogl-feature-private.h \ + $(srcdir)/cogl-feature-private.c \ + $(srcdir)/cogl-fixed.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-vertex-buffer-private.h \ + $(srcdir)/cogl-vertex-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.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-pipeline-opengl.c \ + $(srcdir)/cogl-pipeline-opengl-private.h \ + $(srcdir)/cogl-pipeline-fragend-glsl.c \ + $(srcdir)/cogl-pipeline-fragend-glsl-private.h \ + $(srcdir)/cogl-pipeline-fragend-arbfp.c \ + $(srcdir)/cogl-pipeline-fragend-arbfp-private.h \ + $(srcdir)/cogl-pipeline-fragend-fixed.c \ + $(srcdir)/cogl-pipeline-fragend-fixed-private.h \ + $(srcdir)/cogl-pipeline-vertend-glsl.c \ + $(srcdir)/cogl-pipeline-vertend-glsl-private.h \ + $(srcdir)/cogl-pipeline-vertend-fixed.c \ + $(srcdir)/cogl-pipeline-vertend-fixed-private.h \ + $(srcdir)/cogl-pipeline-progend-fixed.c \ + $(srcdir)/cogl-pipeline-progend-fixed-private.h \ + $(srcdir)/cogl-pipeline-progend-glsl.c \ + $(srcdir)/cogl-pipeline-progend-glsl-private.h \ + $(srcdir)/cogl-pipeline-snippet-private.h \ + $(srcdir)/cogl-pipeline-snippet.c \ + $(srcdir)/cogl-pipeline-cache.h \ + $(srcdir)/cogl-pipeline-cache.c \ + $(srcdir)/cogl-material-compat.c \ + $(srcdir)/cogl-program.c \ + $(srcdir)/cogl-program-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-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-framebuffer-private.h \ + $(srcdir)/cogl-framebuffer.c \ + $(srcdir)/cogl-onscreen-private.h \ + $(srcdir)/cogl-onscreen.c \ + $(srcdir)/cogl-profile.h \ + $(srcdir)/cogl-profile.c \ + $(srcdir)/cogl-flags.h \ + $(srcdir)/cogl-bitmask.h \ + $(srcdir)/cogl-bitmask.c \ + $(srcdir)/cogl-shader-boilerplate.h \ + $(srcdir)/cogl-shader-private.h \ + $(srcdir)/cogl-shader.c \ + $(srcdir)/cogl-gtype-private.h \ + $(srcdir)/cogl-point-in-poly-private.h \ + $(srcdir)/cogl-point-in-poly.c \ + $(srcdir)/cogl-clutter.c \ + $(srcdir)/winsys/cogl-winsys-stub-private.h \ + $(srcdir)/cogl-queue.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.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 \ + $(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_1_public_h += \ + $(srcdir)/cogl-clutter-xlib.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_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 +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_sources_c += \ + $(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_sources_c += \ + $(srcdir)/winsys/cogl-winsys-sdl-private.h \ + $(srcdir)/winsys/cogl-winsys-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 = -lm $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) +if SUPPORT_GLX +libcogl_la_LIBADD += -ldl +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_foreach_sub_texture_in_region|_cogl_atlas_texture_new_with_size|_cogl_profile_trace_message|_cogl_context_get_default).*" + +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) + +coglincludedir = $(includedir)/cogl/cogl +coglinclude_HEADERS = $(cogl_headers) $(cogl_experimental_h) +nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.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 \ + cogl-defines.h.win32_SDL \ + 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 +Cogl_1_0_gir_FILES = $(cogl_1_public_h) cogl-enum-types.h +Cogl_1_0_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API -UCOGL_ENABLE_EXPERIMENTAL_2_0_API +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' + +INTROSPECTION_GIRS += Cogl-1.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..b5eef81 --- /dev/null +++ b/cogl/Makefile.in @@ -0,0 +1,2724 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = $(am__coglinclude_HEADERS_DIST) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/cogl-1.0.pc.in \ + $(srcdir)/cogl-2.0-experimental.pc.in \ + $(srcdir)/cogl-defines.h.in $(srcdir)/cogl.rc.in \ + $(top_srcdir)/build/autotools/Makefile.am.enums \ + $(top_srcdir)/build/autotools/Makefile.am.silent +@COGL_DRIVER_GL_SUPPORTED_TRUE@am__append_1 = \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ $(srcdir)/driver/gl/cogl-gl.c \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ $(srcdir)/driver/gl/cogl-texture-driver-gl.c \ +@COGL_DRIVER_GL_SUPPORTED_TRUE@ $(NULL) + +@COGL_DRIVER_GLES_SUPPORTED_TRUE@am__append_2 = \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(srcdir)/driver/gles/cogl-gles.c \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(srcdir)/driver/gles/cogl-texture-driver-gles.c \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(NULL) + +@USE_GLIB_TRUE@am__append_3 = \ +@USE_GLIB_TRUE@ $(srcdir)/cogl-glib-source.h + +@USE_GLIB_TRUE@am__append_4 = \ +@USE_GLIB_TRUE@ $(srcdir)/cogl-glib-source.c + +@SUPPORT_XLIB_TRUE@am__append_5 = \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-clutter-xlib.h \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib-renderer.h + +@SUPPORT_XLIB_TRUE@am__append_6 = \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/winsys/cogl-texture-pixmap-x11.h \ +@SUPPORT_XLIB_TRUE@ $(srcdir)/cogl-xlib.h + +@SUPPORT_XLIB_TRUE@am__append_7 = \ +@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_8 = \ +@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_9 = \ +@SUPPORT_WGL_TRUE@ $(srcdir)/cogl-win32-renderer.h + +@SUPPORT_WGL_TRUE@am__append_10 = \ +@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_11 = \ +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@ $(srcdir)/cogl-wayland-server.h + +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@am__append_12 = \ +@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_13 = \ +@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_14 = \ +@SUPPORT_EGL_PLATFORM_KMS_TRUE@ $(srcdir)/cogl-kms-renderer.h + +@SUPPORT_EGL_PLATFORM_KMS_TRUE@am__append_15 = \ +@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_16 = \ +@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_17 = \ +@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_18 = \ +@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_19 = \ +@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_20 = \ +@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_21 = \ +@SUPPORT_SDL_TRUE@ $(srcdir)/winsys/cogl-winsys-sdl-private.h \ +@SUPPORT_SDL_TRUE@ $(srcdir)/winsys/cogl-winsys-sdl.c + +@SUPPORT_GLX_TRUE@am__append_22 = -ldl +@HAVE_INTROSPECTION_TRUE@am__append_23 = Cogl-1.0.gir +@HAVE_INTROSPECTION_TRUE@am__append_24 = $(gir_DATA) $(typelib_DATA) +subdir = cogl +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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.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__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \ + "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" \ + "$(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__libcogl_la_SOURCES_DIST = $(srcdir)/driver/gl/cogl-gl.c \ + $(srcdir)/driver/gl/cogl-texture-driver-gl.c \ + $(srcdir)/driver/gles/cogl-gles.c \ + $(srcdir)/driver/gles/cogl-texture-driver-gles.c \ + $(srcdir)/winsys/cogl-winsys-private.h \ + $(srcdir)/winsys/cogl-winsys.c \ + $(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 \ + $(srcdir)/cogl-private.h $(srcdir)/cogl-debug.h \ + $(srcdir)/cogl-debug-options.h $(srcdir)/cogl-handle.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-internal.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-path-private.h $(srcdir)/cogl-path.h \ + $(srcdir)/cogl-path.c $(srcdir)/cogl2-path.h \ + $(srcdir)/cogl2-path.c $(srcdir)/cogl-bitmap-pixbuf.c \ + $(srcdir)/cogl-clip-stack.h $(srcdir)/cogl-clip-stack.c \ + $(srcdir)/cogl-clip-state-private.h \ + $(srcdir)/cogl-clip-state.h $(srcdir)/cogl-clip-state.c \ + $(srcdir)/cogl2-compatibility.c \ + $(srcdir)/cogl-feature-private.h \ + $(srcdir)/cogl-feature-private.c $(srcdir)/cogl-fixed.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-vertex-buffer-private.h \ + $(srcdir)/cogl-vertex-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.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-pipeline-opengl.c \ + $(srcdir)/cogl-pipeline-opengl-private.h \ + $(srcdir)/cogl-pipeline-fragend-glsl.c \ + $(srcdir)/cogl-pipeline-fragend-glsl-private.h \ + $(srcdir)/cogl-pipeline-fragend-arbfp.c \ + $(srcdir)/cogl-pipeline-fragend-arbfp-private.h \ + $(srcdir)/cogl-pipeline-fragend-fixed.c \ + $(srcdir)/cogl-pipeline-fragend-fixed-private.h \ + $(srcdir)/cogl-pipeline-vertend-glsl.c \ + $(srcdir)/cogl-pipeline-vertend-glsl-private.h \ + $(srcdir)/cogl-pipeline-vertend-fixed.c \ + $(srcdir)/cogl-pipeline-vertend-fixed-private.h \ + $(srcdir)/cogl-pipeline-progend-fixed.c \ + $(srcdir)/cogl-pipeline-progend-fixed-private.h \ + $(srcdir)/cogl-pipeline-progend-glsl.c \ + $(srcdir)/cogl-pipeline-progend-glsl-private.h \ + $(srcdir)/cogl-pipeline-snippet-private.h \ + $(srcdir)/cogl-pipeline-snippet.c \ + $(srcdir)/cogl-pipeline-cache.h \ + $(srcdir)/cogl-pipeline-cache.c \ + $(srcdir)/cogl-material-compat.c $(srcdir)/cogl-program.c \ + $(srcdir)/cogl-program-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-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-framebuffer-private.h \ + $(srcdir)/cogl-framebuffer.c $(srcdir)/cogl-onscreen-private.h \ + $(srcdir)/cogl-onscreen.c $(srcdir)/cogl-profile.h \ + $(srcdir)/cogl-profile.c $(srcdir)/cogl-flags.h \ + $(srcdir)/cogl-bitmask.h $(srcdir)/cogl-bitmask.c \ + $(srcdir)/cogl-shader-boilerplate.h \ + $(srcdir)/cogl-shader-private.h $(srcdir)/cogl-shader.c \ + $(srcdir)/cogl-gtype-private.h \ + $(srcdir)/cogl-point-in-poly-private.h \ + $(srcdir)/cogl-point-in-poly.c $(srcdir)/cogl-clutter.c \ + $(srcdir)/winsys/cogl-winsys-stub-private.h \ + $(srcdir)/cogl-queue.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.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-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)/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 +am__objects_1 = +@COGL_DRIVER_GL_SUPPORTED_TRUE@am__objects_2 = cogl-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-gles.lo \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ cogl-texture-driver-gles.lo \ +@COGL_DRIVER_GLES_SUPPORTED_TRUE@ $(am__objects_1) +am__objects_4 = $(am__objects_2) $(am__objects_3) +am__objects_5 = cogl-winsys.lo $(am__objects_1) +am__objects_6 = dict.lo geom.lo mesh.lo normal.lo priorityq.lo \ + render.lo sweep.lo tess.lo tessmono.lo $(am__objects_1) +@USE_GLIB_TRUE@am__objects_7 = cogl-glib-source.lo +@SUPPORT_XLIB_TRUE@am__objects_8 = cogl-xlib-renderer.lo cogl-xlib.lo \ +@SUPPORT_XLIB_TRUE@ cogl-texture-pixmap-x11.lo +@SUPPORT_GLX_TRUE@am__objects_9 = cogl-winsys-glx.lo +@SUPPORT_WGL_TRUE@am__objects_10 = cogl-win32-renderer.lo \ +@SUPPORT_WGL_TRUE@ cogl-winsys-wgl.lo +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@am__objects_11 = \ +@SUPPORT_EGL_PLATFORM_WAYLAND_TRUE@ cogl-winsys-egl-wayland.lo +@SUPPORT_EGL_PLATFORM_KMS_TRUE@am__objects_12 = \ +@SUPPORT_EGL_PLATFORM_KMS_TRUE@ cogl-winsys-egl-kms.lo +@SUPPORT_EGL_PLATFORM_XLIB_TRUE@am__objects_13 = \ +@SUPPORT_EGL_PLATFORM_XLIB_TRUE@ cogl-winsys-egl-x11.lo +@SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE@am__objects_14 = cogl-winsys-egl-null.lo +@SUPPORT_EGL_PLATFORM_GDL_TRUE@am__objects_15 = \ +@SUPPORT_EGL_PLATFORM_GDL_TRUE@ cogl-winsys-egl-gdl.lo +@SUPPORT_EGL_PLATFORM_ANDROID_TRUE@am__objects_16 = \ +@SUPPORT_EGL_PLATFORM_ANDROID_TRUE@ cogl-winsys-egl-android.lo +@SUPPORT_EGL_TRUE@am__objects_17 = cogl-winsys-egl.lo +@SUPPORT_SDL_TRUE@am__objects_18 = cogl-winsys-sdl.lo +am__objects_19 = $(am__objects_4) $(am__objects_5) $(am__objects_6) \ + 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-path.lo \ + cogl2-path.lo cogl-bitmap-pixbuf.lo cogl-clip-stack.lo \ + cogl-clip-state.lo cogl2-compatibility.lo \ + cogl-feature-private.lo cogl-fixed.lo cogl-color.lo \ + cogl-buffer.lo cogl-pixel-buffer.lo cogl-vertex-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-pipeline-opengl.lo cogl-pipeline-fragend-glsl.lo \ + cogl-pipeline-fragend-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 \ + cogl-pipeline-snippet.lo cogl-pipeline-cache.lo \ + cogl-material-compat.lo cogl-program.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-blit.lo cogl-spans.lo \ + cogl-journal.lo cogl-framebuffer.lo cogl-onscreen.lo \ + cogl-profile.lo cogl-bitmask.lo cogl-shader.lo \ + cogl-point-in-poly.lo cogl-clutter.lo cogl-winsys-stub.lo \ + cogl-config.lo cogl-boxed-value.lo cogl-snippet.lo \ + cogl-poll.lo $(am__objects_1) $(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_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libcogl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libcogl_la_LDFLAGS) $(LDFLAGS) -o $@ +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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libcogl_la_SOURCES) $(nodist_libcogl_la_SOURCES) +DIST_SOURCES = $(am__libcogl_la_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) +am__coglinclude_HEADERS_DIST = $(srcdir)/cogl1-context.h \ + $(srcdir)/cogl-bitmap.h $(srcdir)/cogl-color.h \ + $(srcdir)/cogl-fixed.h $(srcdir)/cogl-material-compat.h \ + $(srcdir)/cogl-matrix.h $(srcdir)/cogl-offscreen.h \ + $(srcdir)/cogl-primitives.h $(srcdir)/cogl-path.h \ + $(srcdir)/cogl-path-functions.h $(srcdir)/cogl-shader.h \ + $(srcdir)/cogl-texture.h $(srcdir)/cogl-types.h \ + $(srcdir)/cogl-vertex-buffer.h $(srcdir)/cogl-clutter.h \ + $(srcdir)/cogl.h $(srcdir)/cogl-clutter-xlib.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)/cogl2-path.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-clip-state.h $(srcdir)/cogl-framebuffer.h \ + $(srcdir)/cogl-onscreen.h $(srcdir)/cogl-vector.h \ + $(srcdir)/cogl-euler.h $(srcdir)/cogl-quaternion.h \ + $(srcdir)/cogl-poll.h $(srcdir)/cogl-texture-3d.h \ + $(srcdir)/cogl-texture-2d.h $(srcdir)/cogl-texture-rectangle.h \ + $(srcdir)/cogl-texture-2d-sliced.h \ + $(srcdir)/cogl-sub-texture.h $(srcdir)/cogl-meta-texture.h \ + $(srcdir)/cogl-depth-state.h $(srcdir)/cogl-buffer.h \ + $(srcdir)/cogl-pixel-buffer.h $(srcdir)/cogl2-experimental.h \ + $(srcdir)/cogl2-compatibility.h $(srcdir)/cogl-glib-source.h \ + $(srcdir)/winsys/cogl-texture-pixmap-x11.h \ + $(srcdir)/cogl-xlib.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 +HEADERS = $(coglinclude_HEADERS) $(nodist_coglinclude_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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 $(glib_enum_h) $(glib_enum_c) +EXTRA_DIST = cogl-defines.h.in cogl-1.0.pc.in \ + cogl-$(COGL_API_VERSION)-experimental.pc.in \ + $(srcdir)/tesselator/README \ + $(srcdir)/tesselator/priorityq-heap.c $(NULL) stb_image.c \ + $(enum_tmpl_h) $(enum_tmpl_c) cogl-defines.h.win32 \ + cogl-defines.h.win32_SDL cogl.symbols cogl.rc.in cogl.rc +CLEANFILES = stamp-enum-types $(am__append_24) +DISTCLEANFILES = cogl-defines.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 +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + -I$(srcdir)/tesselator \ + -I$(srcdir)/winsys \ + -I$(srcdir)/driver/$(COGL_DRIVER) \ + $(NULL) + +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"Cogl\" \ + -DCLUTTER_COMPILATION \ + -DCOGL_GL_LIBNAME=\"$(COGL_GL_LIBNAME)\" \ + -DCOGL_GLES1_LIBNAME=\"$(COGL_GLES1_LIBNAME)\" \ + -DCOGL_GLES2_LIBNAME=\"$(COGL_GLES2_LIBNAME)\" \ + -DCOGL_LOCALEDIR=\""$(localedir)"\" \ + $(NULL) + +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) + +# public 1.x api headers +cogl_1_public_h = $(srcdir)/cogl1-context.h $(srcdir)/cogl-bitmap.h \ + $(srcdir)/cogl-color.h $(srcdir)/cogl-fixed.h \ + $(srcdir)/cogl-material-compat.h $(srcdir)/cogl-matrix.h \ + $(srcdir)/cogl-offscreen.h $(srcdir)/cogl-primitives.h \ + $(srcdir)/cogl-path.h $(srcdir)/cogl-path-functions.h \ + $(srcdir)/cogl-shader.h $(srcdir)/cogl-texture.h \ + $(srcdir)/cogl-types.h $(srcdir)/cogl-vertex-buffer.h \ + $(srcdir)/cogl-clutter.h $(srcdir)/cogl.h $(NULL) \ + $(am__append_5) + +# 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)/cogl2-path.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-clip-state.h $(srcdir)/cogl-framebuffer.h \ + $(srcdir)/cogl-onscreen.h $(srcdir)/cogl-vector.h \ + $(srcdir)/cogl-euler.h $(srcdir)/cogl-quaternion.h \ + $(srcdir)/cogl-poll.h $(srcdir)/cogl-texture-3d.h \ + $(srcdir)/cogl-texture-2d.h $(srcdir)/cogl-texture-rectangle.h \ + $(srcdir)/cogl-texture-2d-sliced.h \ + $(srcdir)/cogl-sub-texture.h $(srcdir)/cogl-meta-texture.h \ + $(srcdir)/cogl-depth-state.h $(srcdir)/cogl-buffer.h \ + $(srcdir)/cogl-pixel-buffer.h $(srcdir)/cogl2-experimental.h \ + $(srcdir)/cogl2-compatibility.h $(NULL) $(am__append_3) \ + $(am__append_6) $(am__append_9) $(am__append_11) \ + $(am__append_12) $(am__append_14) + +# driver sources +cogl_driver_sources = $(am__append_1) $(am__append_2) + +# winsys sources, common to all backends +cogl_winsys_common_sources = \ + $(srcdir)/winsys/cogl-winsys-private.h \ + $(srcdir)/winsys/cogl-winsys.c \ + $(NULL) + + +# 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) + + +# sources +cogl_sources_c = $(cogl_driver_sources) $(cogl_winsys_common_sources) \ + $(cogl_tesselator_sources) $(srcdir)/cogl-private.h \ + $(srcdir)/cogl-debug.h $(srcdir)/cogl-debug-options.h \ + $(srcdir)/cogl-handle.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-internal.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-path-private.h $(srcdir)/cogl-path.h \ + $(srcdir)/cogl-path.c $(srcdir)/cogl2-path.h \ + $(srcdir)/cogl2-path.c $(srcdir)/cogl-bitmap-pixbuf.c \ + $(srcdir)/cogl-clip-stack.h $(srcdir)/cogl-clip-stack.c \ + $(srcdir)/cogl-clip-state-private.h \ + $(srcdir)/cogl-clip-state.h $(srcdir)/cogl-clip-state.c \ + $(srcdir)/cogl2-compatibility.c \ + $(srcdir)/cogl-feature-private.h \ + $(srcdir)/cogl-feature-private.c $(srcdir)/cogl-fixed.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-vertex-buffer-private.h \ + $(srcdir)/cogl-vertex-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.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-pipeline-opengl.c \ + $(srcdir)/cogl-pipeline-opengl-private.h \ + $(srcdir)/cogl-pipeline-fragend-glsl.c \ + $(srcdir)/cogl-pipeline-fragend-glsl-private.h \ + $(srcdir)/cogl-pipeline-fragend-arbfp.c \ + $(srcdir)/cogl-pipeline-fragend-arbfp-private.h \ + $(srcdir)/cogl-pipeline-fragend-fixed.c \ + $(srcdir)/cogl-pipeline-fragend-fixed-private.h \ + $(srcdir)/cogl-pipeline-vertend-glsl.c \ + $(srcdir)/cogl-pipeline-vertend-glsl-private.h \ + $(srcdir)/cogl-pipeline-vertend-fixed.c \ + $(srcdir)/cogl-pipeline-vertend-fixed-private.h \ + $(srcdir)/cogl-pipeline-progend-fixed.c \ + $(srcdir)/cogl-pipeline-progend-fixed-private.h \ + $(srcdir)/cogl-pipeline-progend-glsl.c \ + $(srcdir)/cogl-pipeline-progend-glsl-private.h \ + $(srcdir)/cogl-pipeline-snippet-private.h \ + $(srcdir)/cogl-pipeline-snippet.c \ + $(srcdir)/cogl-pipeline-cache.h \ + $(srcdir)/cogl-pipeline-cache.c \ + $(srcdir)/cogl-material-compat.c $(srcdir)/cogl-program.c \ + $(srcdir)/cogl-program-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-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-framebuffer-private.h \ + $(srcdir)/cogl-framebuffer.c $(srcdir)/cogl-onscreen-private.h \ + $(srcdir)/cogl-onscreen.c $(srcdir)/cogl-profile.h \ + $(srcdir)/cogl-profile.c $(srcdir)/cogl-flags.h \ + $(srcdir)/cogl-bitmask.h $(srcdir)/cogl-bitmask.c \ + $(srcdir)/cogl-shader-boilerplate.h \ + $(srcdir)/cogl-shader-private.h $(srcdir)/cogl-shader.c \ + $(srcdir)/cogl-gtype-private.h \ + $(srcdir)/cogl-point-in-poly-private.h \ + $(srcdir)/cogl-point-in-poly.c $(srcdir)/cogl-clutter.c \ + $(srcdir)/winsys/cogl-winsys-stub-private.h \ + $(srcdir)/cogl-queue.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.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 $(NULL) \ + $(am__append_4) $(am__append_7) $(am__append_8) \ + $(am__append_10) $(am__append_13) $(am__append_15) \ + $(am__append_16) $(am__append_17) $(am__append_18) \ + $(am__append_19) $(am__append_20) $(am__append_21) + +# 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 = -lm $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS) \ + $(am__append_22) +# 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_foreach_sub_texture_in_region|_cogl_atlas_texture_new_with_size|_cogl_profile_trace_message|_cogl_context_get_default).*" + +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) + +coglincludedir = $(includedir)/cogl/cogl +coglinclude_HEADERS = $(cogl_headers) $(cogl_experimental_h) +nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h +INTROSPECTION_GIRS = $(am__append_23) +@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@Cogl_1_0_gir_FILES = $(cogl_1_public_h) cogl-enum-types.h +@HAVE_INTROSPECTION_TRUE@Cogl_1_0_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_ENABLE_EXPERIMENTAL_API -UCOGL_ENABLE_EXPERIMENTAL_2_0_API +@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@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_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.rc: $(top_builddir)/config.status $(srcdir)/cogl.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcogl.la: $(libcogl_la_OBJECTS) $(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.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.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-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-enum-types.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-fixed.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-framebuffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-gl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-gles.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl-glib-source.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-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-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-path.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-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.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.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-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-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-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-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.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-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@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl2-compatibility.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cogl2-path.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dict.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geom.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mesh.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/normal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/priorityq.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sweep.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tess.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +cogl-gl.lo: $(srcdir)/driver/gl/cogl-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-gl.lo -MD -MP -MF $(DEPDIR)/cogl-gl.Tpo -c -o cogl-gl.lo `test -f '$(srcdir)/driver/gl/cogl-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-gl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-gl.Tpo $(DEPDIR)/cogl-gl.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/driver/gl/cogl-gl.c' object='cogl-gl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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-gl.lo `test -f '$(srcdir)/driver/gl/cogl-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-gl.c + +cogl-texture-driver-gl.lo: $(srcdir)/driver/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/cogl-texture-driver-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/driver/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@ $(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/cogl-texture-driver-gl.c' || echo '$(srcdir)/'`$(srcdir)/driver/gl/cogl-texture-driver-gl.c + +cogl-gles.lo: $(srcdir)/driver/gles/cogl-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-gles.lo -MD -MP -MF $(DEPDIR)/cogl-gles.Tpo -c -o cogl-gles.lo `test -f '$(srcdir)/driver/gles/cogl-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/gles/cogl-gles.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-gles.Tpo $(DEPDIR)/cogl-gles.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/driver/gles/cogl-gles.c' object='cogl-gles.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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-gles.lo `test -f '$(srcdir)/driver/gles/cogl-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/gles/cogl-gles.c + +cogl-texture-driver-gles.lo: $(srcdir)/driver/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/gles/cogl-texture-driver-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/driver/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@ $(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/gles/cogl-texture-driver-gles.c' || echo '$(srcdir)/'`$(srcdir)/driver/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 + +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) $(AM_CFLAGS) $(CFLAGS) -MT dict.lo -MD -MP -MF $(DEPDIR)/dict.Tpo -c -o dict.lo `test -f '$(srcdir)/tesselator/dict.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/dict.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dict.Tpo $(DEPDIR)/dict.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/dict.c' object='dict.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dict.lo `test -f '$(srcdir)/tesselator/dict.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/dict.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT geom.lo -MD -MP -MF $(DEPDIR)/geom.Tpo -c -o geom.lo `test -f '$(srcdir)/tesselator/geom.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/geom.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/geom.Tpo $(DEPDIR)/geom.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/geom.c' object='geom.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o geom.lo `test -f '$(srcdir)/tesselator/geom.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/geom.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT mesh.lo -MD -MP -MF $(DEPDIR)/mesh.Tpo -c -o mesh.lo `test -f '$(srcdir)/tesselator/mesh.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/mesh.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mesh.Tpo $(DEPDIR)/mesh.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/mesh.c' object='mesh.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mesh.lo `test -f '$(srcdir)/tesselator/mesh.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/mesh.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT normal.lo -MD -MP -MF $(DEPDIR)/normal.Tpo -c -o normal.lo `test -f '$(srcdir)/tesselator/normal.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/normal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/normal.Tpo $(DEPDIR)/normal.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/normal.c' object='normal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o normal.lo `test -f '$(srcdir)/tesselator/normal.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/normal.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT priorityq.lo -MD -MP -MF $(DEPDIR)/priorityq.Tpo -c -o priorityq.lo `test -f '$(srcdir)/tesselator/priorityq.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/priorityq.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/priorityq.Tpo $(DEPDIR)/priorityq.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/priorityq.c' object='priorityq.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o priorityq.lo `test -f '$(srcdir)/tesselator/priorityq.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/priorityq.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT render.lo -MD -MP -MF $(DEPDIR)/render.Tpo -c -o render.lo `test -f '$(srcdir)/tesselator/render.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/render.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/render.Tpo $(DEPDIR)/render.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/render.c' object='render.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o render.lo `test -f '$(srcdir)/tesselator/render.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/render.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT sweep.lo -MD -MP -MF $(DEPDIR)/sweep.Tpo -c -o sweep.lo `test -f '$(srcdir)/tesselator/sweep.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/sweep.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sweep.Tpo $(DEPDIR)/sweep.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/sweep.c' object='sweep.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sweep.lo `test -f '$(srcdir)/tesselator/sweep.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/sweep.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT tess.lo -MD -MP -MF $(DEPDIR)/tess.Tpo -c -o tess.lo `test -f '$(srcdir)/tesselator/tess.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tess.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tess.Tpo $(DEPDIR)/tess.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/tess.c' object='tess.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tess.lo `test -f '$(srcdir)/tesselator/tess.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tess.c + +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) $(AM_CFLAGS) $(CFLAGS) -MT tessmono.lo -MD -MP -MF $(DEPDIR)/tessmono.Tpo -c -o tessmono.lo `test -f '$(srcdir)/tesselator/tessmono.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tessmono.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tessmono.Tpo $(DEPDIR)/tessmono.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/tesselator/tessmono.c' object='tessmono.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tessmono.lo `test -f '$(srcdir)/tesselator/tessmono.c' || echo '$(srcdir)/'`$(srcdir)/tesselator/tessmono.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl.c' object='cogl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-path.lo: $(srcdir)/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) $(AM_CFLAGS) $(CFLAGS) -MT cogl-path.lo -MD -MP -MF $(DEPDIR)/cogl-path.Tpo -c -o cogl-path.lo `test -f '$(srcdir)/cogl-path.c' || echo '$(srcdir)/'`$(srcdir)/cogl-path.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-path.Tpo $(DEPDIR)/cogl-path.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl-path.c' object='cogl-path.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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-path.lo `test -f '$(srcdir)/cogl-path.c' || echo '$(srcdir)/'`$(srcdir)/cogl-path.c + +cogl2-path.lo: $(srcdir)/cogl2-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) $(AM_CFLAGS) $(CFLAGS) -MT cogl2-path.lo -MD -MP -MF $(DEPDIR)/cogl2-path.Tpo -c -o cogl2-path.lo `test -f '$(srcdir)/cogl2-path.c' || echo '$(srcdir)/'`$(srcdir)/cogl2-path.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl2-path.Tpo $(DEPDIR)/cogl2-path.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl2-path.c' object='cogl2-path.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl2-path.lo `test -f '$(srcdir)/cogl2-path.c' || echo '$(srcdir)/'`$(srcdir)/cogl2-path.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-clip-state.lo: $(srcdir)/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)/cogl-clip-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-clip-state.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-clip-state.Tpo $(DEPDIR)/cogl-clip-state.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-clip-state.c' || echo '$(srcdir)/'`$(srcdir)/cogl-clip-state.c + +cogl2-compatibility.lo: $(srcdir)/cogl2-compatibility.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 cogl2-compatibility.lo -MD -MP -MF $(DEPDIR)/cogl2-compatibility.Tpo -c -o cogl2-compatibility.lo `test -f '$(srcdir)/cogl2-compatibility.c' || echo '$(srcdir)/'`$(srcdir)/cogl2-compatibility.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl2-compatibility.Tpo $(DEPDIR)/cogl2-compatibility.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl2-compatibility.c' object='cogl2-compatibility.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cogl2-compatibility.lo `test -f '$(srcdir)/cogl2-compatibility.c' || echo '$(srcdir)/'`$(srcdir)/cogl2-compatibility.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-fixed.lo: $(srcdir)/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)/cogl-fixed.c' || echo '$(srcdir)/'`$(srcdir)/cogl-fixed.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-fixed.Tpo $(DEPDIR)/cogl-fixed.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl-fixed.c' object='cogl-fixed.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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)/cogl-fixed.c' || echo '$(srcdir)/'`$(srcdir)/cogl-fixed.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-vertex-buffer.lo: $(srcdir)/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)/cogl-vertex-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-vertex-buffer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-vertex-buffer.Tpo $(DEPDIR)/cogl-vertex-buffer.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-vertex-buffer.c' || echo '$(srcdir)/'`$(srcdir)/cogl-vertex-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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-pipeline-opengl.lo: $(srcdir)/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)/cogl-pipeline-opengl.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-opengl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-pipeline-opengl.Tpo $(DEPDIR)/cogl-pipeline-opengl.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-opengl.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-opengl.c + +cogl-pipeline-fragend-glsl.lo: $(srcdir)/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)/cogl-pipeline-fragend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-fragend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-fragend-glsl.c + +cogl-pipeline-fragend-arbfp.lo: $(srcdir)/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)/cogl-pipeline-fragend-arbfp.c' || echo '$(srcdir)/'`$(srcdir)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-fragend-arbfp.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-fragend-arbfp.c + +cogl-pipeline-fragend-fixed.lo: $(srcdir)/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)/cogl-pipeline-fragend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-fragend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-fragend-fixed.c + +cogl-pipeline-vertend-glsl.lo: $(srcdir)/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)/cogl-pipeline-vertend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-vertend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-vertend-glsl.c + +cogl-pipeline-vertend-fixed.lo: $(srcdir)/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)/cogl-pipeline-vertend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-vertend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-vertend-fixed.c + +cogl-pipeline-progend-fixed.lo: $(srcdir)/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)/cogl-pipeline-progend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-progend-fixed.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-progend-fixed.c + +cogl-pipeline-progend-glsl.lo: $(srcdir)/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)/cogl-pipeline-progend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-pipeline-progend-glsl.c' || echo '$(srcdir)/'`$(srcdir)/cogl-pipeline-progend-glsl.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-material-compat.lo: $(srcdir)/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)/cogl-material-compat.c' || echo '$(srcdir)/'`$(srcdir)/cogl-material-compat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-material-compat.Tpo $(DEPDIR)/cogl-material-compat.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/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@ $(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)/cogl-material-compat.c' || echo '$(srcdir)/'`$(srcdir)/cogl-material-compat.c + +cogl-program.lo: $(srcdir)/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)/cogl-program.c' || echo '$(srcdir)/'`$(srcdir)/cogl-program.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-program.Tpo $(DEPDIR)/cogl-program.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl-program.c' object='cogl-program.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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)/cogl-program.c' || echo '$(srcdir)/'`$(srcdir)/cogl-program.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-shader.lo: $(srcdir)/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)/cogl-shader.c' || echo '$(srcdir)/'`$(srcdir)/cogl-shader.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-shader.Tpo $(DEPDIR)/cogl-shader.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl-shader.c' object='cogl-shader.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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)/cogl-shader.c' || echo '$(srcdir)/'`$(srcdir)/cogl-shader.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-clutter.lo: $(srcdir)/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)/cogl-clutter.c' || echo '$(srcdir)/'`$(srcdir)/cogl-clutter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cogl-clutter.Tpo $(DEPDIR)/cogl-clutter.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/cogl-clutter.c' object='cogl-clutter.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(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)/cogl-clutter.c' || echo '$(srcdir)/'`$(srcdir)/cogl-clutter.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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-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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-girDATA: $(gir_DATA) + @$(NORMAL_INSTALL) + test -z "$(girdir)" || $(MKDIR_P) "$(DESTDIR)$(girdir)" + @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(girdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(girdir)" && rm -f $$files +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files +install-typelibDATA: $(typelib_DATA) + @$(NORMAL_INSTALL) + test -z "$(typelibdir)" || $(MKDIR_P) "$(DESTDIR)$(typelibdir)" + @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(typelibdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(typelibdir)" && rm -f $$files +install-coglincludeHEADERS: $(coglinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(coglincludedir)" || $(MKDIR_P) "$(DESTDIR)$(coglincludedir)" + @list='$(coglinclude_HEADERS)'; test -n "$(coglincludedir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(coglincludedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(coglincludedir)" && rm -f $$files +install-nodist_coglincludeHEADERS: $(nodist_coglinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(coglincludedir)" || $(MKDIR_P) "$(DESTDIR)$(coglincludedir)" + @list='$(nodist_coglinclude_HEADERS)'; test -n "$(coglincludedir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(coglincludedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(coglincludedir)" && rm -f $$files + +# 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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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)$(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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-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-coglincludeHEADERS uninstall-girDATA \ + uninstall-libLTLIBRARIES uninstall-nodist_coglincludeHEADERS \ + uninstall-pkgconfigDATA uninstall-typelibDATA + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + ctags-recursive install install-am install-strip \ + tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ + ctags ctags-recursive 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-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-recursive \ + uninstall uninstall-am uninstall-coglincludeHEADERS \ + uninstall-girDATA uninstall-libLTLIBRARIES \ + uninstall-nodist_coglincludeHEADERS uninstall-pkgconfigDATA \ + uninstall-typelibDATA + + +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 + +# 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..4387aff --- /dev/null +++ b/cogl/cogl-atlas-texture-private.h @@ -0,0 +1,80 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_ATLAS_TEXTURE_H +#define __COGL_ATLAS_TEXTURE_H + +#include "cogl-handle.h" +#include "cogl-texture-private.h" +#include "cogl-rectangle-map.h" +#include "cogl-atlas.h" + +#define COGL_ATLAS_TEXTURE(tex) ((CoglAtlasTexture *) tex) + +typedef struct _CoglAtlasTexture CoglAtlasTexture; + +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 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; + + /* A CoglSubTexture representing the region for easy rendering */ + CoglHandle sub_texture; +}; + +CoglHandle +_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format); + +CoglHandle +_cogl_atlas_texture_new_with_size (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat internal_format); + +void +_cogl_atlas_texture_add_reorganize_callback (GHookFunc callback, + void *user_data); + +void +_cogl_atlas_texture_remove_reorganize_callback (GHookFunc callback, + void *user_data); + +gboolean +_cogl_is_atlas_texture (void *object); + +#endif /* __COGL_ATLAS_TEXTURE_H */ diff --git a/cogl/cogl-atlas-texture.c b/cogl/cogl-atlas-texture.c new file mode 100644 index 0000000..2701b87 --- /dev/null +++ b/cogl/cogl-atlas-texture.c @@ -0,0 +1,841 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009,2010,2011 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-internal.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-handle.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 + +static void _cogl_atlas_texture_free (CoglAtlasTexture *sub_tex); + +COGL_TEXTURE_INTERNAL_DEFINE (AtlasTexture, atlas_texture); + +static const CoglTextureVtable cogl_atlas_texture_vtable; + +static CoglHandle +_cogl_atlas_texture_create_sub_texture (CoglHandle full_texture, + const CoglRectangleMapEntry *rectangle) +{ + /* Create a subtexture for the given rectangle not including the + 1-pixel border */ + _COGL_GET_CONTEXT (ctx, NULL); + 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 (gpointer user_data, + CoglHandle new_texture, + const CoglRectangleMapEntry *rectangle) +{ + CoglAtlasTexture *atlas_tex = user_data; + + /* Update the sub texture */ + if (atlas_tex->sub_texture) + cogl_handle_unref (atlas_tex->sub_texture); + atlas_tex->sub_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_handle_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 (void) +{ + static CoglUserDataKey atlas_private_key; + + CoglAtlas *atlas; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + 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); + + /* Forward on to the sub texture */ + cogl_meta_texture_foreach_in_region (atlas_tex->sub_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_set_wrap_mode_parameters (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_set_wrap_mode_parameters (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); + + cogl_handle_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 gboolean +_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 gboolean +_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 gboolean +_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_set_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + _cogl_texture_set_filters (atlas_tex->sub_texture, min_filter, mag_filter); +} + +static void +_cogl_atlas_texture_migrate_out_of_atlas (CoglAtlasTexture *atlas_tex) +{ + /* Make sure this texture is not in the atlas */ + if (atlas_tex->atlas) + { + CoglHandle sub_texture; + + 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 (); + + sub_texture = + _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, + COGL_TEXTURE_NO_ATLAS, + atlas_tex->format); + + /* 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_handle_unref (atlas_tex->sub_texture); + atlas_tex->sub_texture = sub_texture; + + _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 gboolean +_cogl_atlas_texture_set_region_with_border (CoglAtlasTexture *atlas_tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + CoglAtlas *atlas = atlas_tex->atlas; + + /* Copy the central data */ + if (!cogl_texture_set_region_from_bitmap (atlas->texture, + src_x, src_y, + dst_x + atlas_tex->rectangle.x + 1, + dst_y + atlas_tex->rectangle.y + 1, + dst_width, + dst_height, + bmp)) + return FALSE; + + /* Update the left edge pixels */ + if (dst_x == 0 && + !cogl_texture_set_region_from_bitmap (atlas->texture, + src_x, src_y, + atlas_tex->rectangle.x, + dst_y + atlas_tex->rectangle.y + 1, + 1, dst_height, + bmp)) + 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, + atlas_tex->rectangle.x + + atlas_tex->rectangle.width - 1, + dst_y + atlas_tex->rectangle.y + 1, + 1, dst_height, + bmp)) + return FALSE; + /* Update the top edge pixels */ + if (dst_y == 0 && + !cogl_texture_set_region_from_bitmap (atlas->texture, + src_x, src_y, + dst_x + atlas_tex->rectangle.x + 1, + atlas_tex->rectangle.y, + dst_width, 1, + bmp)) + 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_x + atlas_tex->rectangle.x + 1, + atlas_tex->rectangle.y + + atlas_tex->rectangle.height - 1, + dst_width, 1, + bmp)) + return FALSE; + + return TRUE; +} + +static CoglBitmap * +_cogl_atlas_texture_prepare_for_upload (CoglAtlasTexture *atlas_tex, + CoglBitmap *bmp) +{ + CoglPixelFormat internal_format; + CoglBitmap *converted_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 | + (atlas_tex->format & COGL_PREMULT_BIT)); + + converted_bmp = _cogl_texture_prepare_for_upload (bmp, + internal_format, + NULL, /* dst_format_out */ + NULL, /* glintformat */ + NULL, /* glformat */ + NULL /* gltype */); + + if (converted_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 (converted_bmp, + cogl_bitmap_get_format (converted_bmp) & + ~COGL_PREMULT_BIT, + cogl_bitmap_get_width (converted_bmp), + cogl_bitmap_get_height (converted_bmp), + cogl_bitmap_get_rowstride (converted_bmp)); + + cogl_object_unref (converted_bmp); + + return override_bmp; +} + +static gboolean +_cogl_atlas_texture_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* If the texture is in the atlas then we need to copy the edge + pixels to the border */ + if (atlas_tex->atlas) + { + gboolean ret; + + bmp = _cogl_atlas_texture_prepare_for_upload (atlas_tex, + bmp); + + /* 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, + bmp); + + cogl_object_unref (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_x, dst_y, + dst_width, dst_height, + bmp); +} + +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->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_get_gl_format (atlas_tex->sub_texture); +} + +static int +_cogl_atlas_texture_get_width (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return cogl_texture_get_width (atlas_tex->sub_texture); +} + +static int +_cogl_atlas_texture_get_height (CoglTexture *tex) +{ + CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); + + /* Forward on to the sub texture */ + return cogl_texture_get_height (atlas_tex->sub_texture); +} + +static gboolean +_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); +} + +CoglHandle +_cogl_atlas_texture_new_with_size (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglAtlasTexture *atlas_tex; + CoglAtlas *atlas; + GSList *l; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + /* Don't put textures in the atlas if the user has explicitly + requested to disable it */ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS))) + return COGL_INVALID_HANDLE; + + /* We can't put the texture in the atlas if there are any special + flags. This precludes textures with COGL_TEXTURE_NO_ATLAS and + COGL_TEXTURE_NO_SLICING from being atlased */ + if (flags) + return COGL_INVALID_HANDLE; + + /* We can't atlas zero-sized textures because it breaks the atlas + data structure */ + if (width < 1 || height < 1) + return COGL_INVALID_HANDLE; + + /* 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)) + return COGL_INVALID_HANDLE; + + COGL_NOTE (ATLAS, "Adding texture of size %ix%i", width, height); + + /* 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"); + + return COGL_INVALID_HANDLE; + } + + /* 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_new (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), + &cogl_atlas_texture_vtable); + + atlas_tex->sub_texture = COGL_INVALID_HANDLE; + + /* Look for an existing atlas that can hold the texture */ + for (l = ctx->atlases; l; l = l->next) + /* Try to make some space in the atlas for the texture */ + if (_cogl_atlas_reserve_space (atlas = l->data, + /* Add two pixels for the border */ + width + 2, height + 2, + atlas_tex)) + { + cogl_object_ref (atlas); + break; + } + + /* If we couldn't find a suitable atlas then start another */ + if (l == NULL) + { + atlas = _cogl_atlas_texture_create_atlas (); + 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); + g_free (atlas_tex); + return COGL_INVALID_HANDLE; + } + } + + atlas_tex->format = internal_format; + atlas_tex->atlas = atlas; + + return _cogl_atlas_texture_handle_new (atlas_tex); +} + +CoglHandle +_cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglHandle atlas_tex_handle; + CoglAtlasTexture *atlas_tex; + CoglBitmap *dst_bmp; + int bmp_width; + int bmp_height; + CoglPixelFormat bmp_format; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE); + + bmp_width = cogl_bitmap_get_width (bmp); + bmp_height = cogl_bitmap_get_height (bmp); + bmp_format = cogl_bitmap_get_format (bmp); + + internal_format = _cogl_texture_determine_internal_format (bmp_format, + internal_format); + + atlas_tex_handle = _cogl_atlas_texture_new_with_size (bmp_width, bmp_height, + flags, internal_format); + + if (atlas_tex_handle == COGL_INVALID_HANDLE) + return COGL_INVALID_HANDLE; + + atlas_tex = atlas_tex_handle; + + dst_bmp = _cogl_atlas_texture_prepare_for_upload (atlas_tex, + bmp); + + if (dst_bmp == NULL) + { + cogl_handle_unref (atlas_tex_handle); + return COGL_INVALID_HANDLE; + } + + /* Defer to set_region so that we can share the code for copying the + edge pixels to the border. */ + _cogl_atlas_texture_set_region_with_border (atlas_tex, + 0, /* src_x */ + 0, /* src_y */ + 0, /* dst_x */ + 0, /* dst_y */ + bmp_width, /* dst_width */ + bmp_height, /* dst_height */ + dst_bmp); + + cogl_object_unref (dst_bmp); + + return atlas_tex_handle; +} + +void +_cogl_atlas_texture_add_reorganize_callback (GHookFunc callback, + void *user_data) +{ + GHook *hook; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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 (GHookFunc callback, + void *user_data) +{ + GHook *hook; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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 = + { + _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_set_filters, + _cogl_atlas_texture_pre_paint, + _cogl_atlas_texture_ensure_non_quad_rendering, + _cogl_atlas_texture_set_wrap_mode_parameters, + _cogl_atlas_texture_get_format, + _cogl_atlas_texture_get_gl_format, + _cogl_atlas_texture_get_width, + _cogl_atlas_texture_get_height, + _cogl_atlas_texture_get_type, + NULL /* is_foreign */ + }; diff --git a/cogl/cogl-atlas.c b/cogl/cogl-atlas.c new file mode 100644 index 0000000..bfa76dc --- /dev/null +++ b/cogl/cogl-atlas.c @@ -0,0 +1,601 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * 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. + * + * 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-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_handle_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, + CoglHandle old_texture, + CoglHandle 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_type; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + ctx->texture_driver->pixel_format_to_gl (format, + &gl_intformat, + NULL, /* 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 (GL_TEXTURE_2D, + gl_intformat, + 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_type; + + _COGL_GET_CONTEXT (ctx, NULL); + + ctx->texture_driver->pixel_format_to_gl (format, + &gl_intformat, + NULL, /* gl_format */ + &gl_type); + + /* Keep trying increasingly larger atlases until we can fit all of + the textures */ + while (ctx->texture_driver->size_supported (GL_TEXTURE_2D, + gl_intformat, + 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 CoglHandle +_cogl_atlas_create_texture (CoglAtlas *atlas, + int width, + int height) +{ + CoglHandle tex; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + if ((atlas->flags & COGL_ATLAS_CLEAR_TEXTURE)) + { + guint8 *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_NONE, + atlas->texture_format, + NULL); + cogl_object_unref (clear_bmp); + + g_free (clear_data); + } + else + { + tex = cogl_texture_2d_new_with_size (ctx, + width, height, + atlas->texture_format, + 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); +} + +gboolean +_cogl_atlas_reserve_space (CoglAtlas *atlas, + unsigned int width, + unsigned int height, + void *user_data) +{ + CoglAtlasGetRectanglesData data; + CoglRectangleMap *new_map; + CoglHandle new_tex; + unsigned int map_width, map_height; + gboolean 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))) == COGL_INVALID_HANDLE) + { + 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, + new_tex, + user_data); + _cogl_rectangle_map_free (atlas->map); + cogl_handle_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, + new_tex, + &data.textures[0].new_position); + + atlas->map = new_map; + atlas->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))); +}; + +CoglHandle +_cogl_atlas_copy_rectangle (CoglAtlas *atlas, + unsigned int x, + unsigned int y, + unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat format) +{ + CoglHandle tex; + CoglBlitData blit_data; + + /* Create a new texture at the right size */ + tex = cogl_texture_new_with_size (width, height, flags, format); + + /* 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..95c4c11 --- /dev/null +++ b/cogl/cogl-atlas.h @@ -0,0 +1,100 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * 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 __COGL_ATLAS_H +#define __COGL_ATLAS_H + +#include "cogl-rectangle-map.h" +#include "cogl-object-private.h" + +typedef void +(* CoglAtlasUpdatePositionCallback) (void *user_data, + CoglHandle 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; + + CoglHandle 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); + +gboolean +_cogl_atlas_reserve_space (CoglAtlas *atlas, + unsigned int width, + unsigned int height, + void *user_data); + +void +_cogl_atlas_remove (CoglAtlas *atlas, + const CoglRectangleMapEntry *rectangle); + +CoglHandle +_cogl_atlas_copy_rectangle (CoglAtlas *atlas, + unsigned int x, + unsigned int y, + unsigned int width, + unsigned int height, + CoglTextureFlags flags, + 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); + +gboolean +_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..13141d7 --- /dev/null +++ b/cogl/cogl-attribute-buffer-private.h @@ -0,0 +1,38 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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..95adfe0 --- /dev/null +++ b/cogl/cogl-attribute-buffer.c @@ -0,0 +1,81 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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" + +static void _cogl_attribute_buffer_free (CoglAttributeBuffer *array); + +COGL_BUFFER_DEFINE (AttributeBuffer, attribute_buffer); + +CoglAttributeBuffer * +cogl_attribute_buffer_new (CoglContext *context, + gsize bytes, + const void *data) +{ + CoglAttributeBuffer *array = g_slice_new (CoglAttributeBuffer); + gboolean use_malloc; + + if (!(context->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS)) + use_malloc = TRUE; + else + use_malloc = FALSE; + + /* parent's constructor */ + _cogl_buffer_initialize (COGL_BUFFER (array), + context, + bytes, + use_malloc, + COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER, + COGL_BUFFER_USAGE_HINT_ATTRIBUTE_BUFFER, + COGL_BUFFER_UPDATE_HINT_STATIC); + + _cogl_attribute_buffer_object_new (array); + + if (data) + cogl_buffer_set_data (COGL_BUFFER (array), + 0, + data, + bytes); + return array; +} + +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..492ba21 --- /dev/null +++ b/cogl/cogl-attribute-buffer.h @@ -0,0 +1,92 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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 + +G_BEGIN_DECLS + +/** + * SECTION:cogl-attribute-buffer + * @short_description: Functions for creating and manipulating attribute + * buffers + * + * FIXME + */ + +#define COGL_ATTRIBUTE_BUFFER(buffer) ((CoglAttributeBuffer *)(buffer)) + +/** + * cogl_attribute_buffer_new: + * @context: A #CoglContext + * @bytes: The number of bytes to allocate for vertex attribute data. + * @data: An optional pointer to vertex data to upload immediately. + * + * Declares a new #CoglAttributeBuffer of @size bytes to contain arrays of vertex + * attribute data. 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. + * + * Since: 1.4 + * Stability: Unstable + */ +CoglAttributeBuffer * +cogl_attribute_buffer_new (CoglContext *context, + gsize bytes, + const void *data); + +/** + * cogl_is_attribute_buffer: + * @object: A #CoglObject + * + * Gets whether the given object references a #CoglAttributeBuffer. + * + * Returns: %TRUE if the handle references a #CoglAttributeBuffer, + * %FALSE otherwise + * + * Since: 1.4 + * Stability: Unstable + */ +gboolean +cogl_is_attribute_buffer (void *object); + +G_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..aa62120 --- /dev/null +++ b/cogl/cogl-attribute-private.h @@ -0,0 +1,110 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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" + +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_CUSTOM_ARRAY +} CoglAttributeNameID; + +typedef struct _CoglAttributeNameState +{ + char *name; + CoglAttributeNameID name_id; + int name_index; + gboolean normalized_default; + int texture_unit; +} CoglAttributeNameState; + +struct _CoglAttribute +{ + CoglObject _parent; + + CoglAttributeBuffer *attribute_buffer; + const CoglAttributeNameState *name_state; + gsize stride; + gsize offset; + int n_components; + CoglAttributeType type; + gboolean normalized; + + 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 +} 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); + +void +_cogl_attribute_disable_cached_arrays (void); + +void +_cogl_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes); + +#endif /* __COGL_ATTRIBUTE_PRIVATE_H */ + diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c new file mode 100644 index 0000000..3f1ae71 --- /dev/null +++ b/cogl/cogl-attribute.c @@ -0,0 +1,794 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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 +#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); + +static gboolean +validate_cogl_attribute_name (const char *name, + char **real_attribute_name, + CoglAttributeNameID *name_id, + gboolean *normalized, + int *texture_unit) +{ + name = name + 5; /* skip "cogl_" */ + + *normalized = FALSE; + *texture_unit = 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; + *texture_unit = 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 + { + 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->texture_unit)) + goto error; + } + else + { + name_state->name_id = COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY; + name_state->normalized_default = FALSE; + name_state->texture_unit = 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; +} + +CoglAttribute * +cogl_attribute_new (CoglAttributeBuffer *attribute_buffer, + const char *name, + gsize stride, + gsize offset, + int n_components, + CoglAttributeType type) +{ + CoglAttribute *attribute = g_slice_new (CoglAttribute); + + /* FIXME: retrieve the context from the buffer */ + _COGL_GET_CONTEXT (ctx, NULL); + + 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->attribute_buffer = cogl_object_ref (attribute_buffer); + attribute->stride = stride; + attribute->offset = offset; + attribute->n_components = n_components; + attribute->type = type; + attribute->immutable_ref = 0; + + if (attribute->name_state->name_id != COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY) + { + switch (attribute->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; + default: + g_warn_if_reached (); + } + attribute->normalized = attribute->name_state->normalized_default; + } + else + attribute->normalized = FALSE; + + return _cogl_attribute_object_new (attribute); + +error: + _cogl_attribute_free (attribute); + return NULL; +} + +gboolean +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 gboolean seen = FALSE; + if (!seen) + { + g_warning ("Mid-scene modification of attributes has " + "undefined results\n"); + seen = TRUE; + } +} + +void +cogl_attribute_set_normalized (CoglAttribute *attribute, + gboolean 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); + + return attribute->attribute_buffer; +} + +void +cogl_attribute_set_buffer (CoglAttribute *attribute, + CoglAttributeBuffer *attribute_buffer) +{ + _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute)); + + if (G_UNLIKELY (attribute->immutable_ref)) + warn_about_midscene_changes (); + + cogl_object_ref (attribute_buffer); + + cogl_object_unref (attribute->attribute_buffer); + attribute->attribute_buffer = attribute_buffer; +} + +CoglAttribute * +_cogl_attribute_immutable_ref (CoglAttribute *attribute) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL); + + attribute->immutable_ref++; + _cogl_buffer_immutable_ref (COGL_BUFFER (attribute->attribute_buffer)); + return attribute; +} + +void +_cogl_attribute_immutable_unref (CoglAttribute *attribute) +{ + _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute)); + _COGL_RETURN_IF_FAIL (attribute->immutable_ref > 0); + + attribute->immutable_ref--; + _cogl_buffer_immutable_unref (COGL_BUFFER (attribute->attribute_buffer)); +} + +static void +_cogl_attribute_free (CoglAttribute *attribute) +{ + cogl_object_unref (attribute->attribute_buffer); + + g_slice_free (CoglAttribute, attribute); +} + +typedef struct +{ + int unit; + CoglPipelineFlushOptions options; + guint32 fallback_layers; +} ValidateLayerState; + +static gboolean +validate_layer_cb (CoglPipeline *pipeline, + int layer_index, + void *user_data) +{ + CoglTexture *texture = + cogl_pipeline_get_layer_texture (pipeline, layer_index); + ValidateLayerState *state = user_data; + gboolean 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; +} + +typedef struct _ForeachChangedBitState +{ + CoglContext *context; + const CoglBitmask *new_bits; + CoglPipeline *pipeline; +} ForeachChangedBitState; + +static gboolean +toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data) +{ + ForeachChangedBitState *state = user_data; + CoglContext *context = state->context; + + _COGL_RETURN_VAL_IF_FAIL (context->driver == COGL_DRIVER_GL || + context->driver == COGL_DRIVER_GLES1, + FALSE); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + { + gboolean 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 gboolean +toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data) +{ + ForeachChangedBitState *state = user_data; + CoglContext *context = state->context; + + _COGL_RETURN_VAL_IF_FAIL (context->driver == COGL_DRIVER_GL || + context->driver == COGL_DRIVER_GLES1, + FALSE); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + { + gboolean 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 gboolean +toggle_custom_attribute_enabled_cb (int bit_num, void *user_data) +{ + ForeachChangedBitState *state = user_data; + gboolean 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_attribute (CoglContext *context, + CoglPipeline *pipeline, + CoglAttribute *attribute, + guint8 *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) + { + GE( context, glVertexAttribPointer (attrib_location, + attribute->n_components, + attribute->type, + attribute->normalized, + attribute->stride, + base + attribute->offset) ); + _cogl_bitmask_set (&context->enable_custom_attributes_tmp, + attrib_location, TRUE); + } +} + +#endif /* COGL_PIPELINE_PROGEND_GLSL */ + +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_flush_attributes_state (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglDrawFlags flags, + CoglAttribute **attributes, + int n_attributes) +{ + int i; + gboolean skip_gl_color = FALSE; + CoglPipeline *copy = NULL; + int n_tex_coord_attribs = 0; + ValidateLayerState layers_state; + CoglContext *ctx = framebuffer->context; + + 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_dirty (framebuffer); + + /* Iterate the attributes to work out whether blending needs to be + enabled and how many texture coords there are. 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_pipeline_get_real_blend_enabled (pipeline)) + { + CoglPipelineBlendEnable blend_enable = + COGL_PIPELINE_BLEND_ENABLE_ENABLED; + copy = cogl_pipeline_copy (pipeline); + _cogl_pipeline_set_blend_enabled (copy, blend_enable); + pipeline = copy; + } + skip_gl_color = TRUE; + break; + + case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY: + n_tex_coord_attribs++; + 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; + */ + } + + if (G_UNLIKELY (!(flags & COGL_DRAW_SKIP_LEGACY_STATE)) && + G_UNLIKELY (ctx->legacy_state_set) && + _cogl_get_enable_legacy_state ()) + { + /* If we haven't already created a derived pipeline... */ + if (!copy) + { + copy = cogl_pipeline_copy (pipeline); + pipeline = copy; + } + _cogl_pipeline_apply_legacy_state (pipeline); + } + + _cogl_pipeline_flush_gl_state (pipeline, skip_gl_color, n_tex_coord_attribs); + + _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; + guint8 *base; + + attribute_buffer = cogl_attribute_get_buffer (attribute); + buffer = COGL_BUFFER (attribute_buffer); + base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_ATTRIBUTE_BUFFER); + + switch (attribute->name_state->name_id) + { + case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY: +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + setup_generic_attribute (ctx, pipeline, attribute, base); + else +#endif + { + _cogl_bitmask_set (&ctx->enable_builtin_attributes_tmp, + COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY, TRUE); + GE (ctx, glColorPointer (attribute->n_components, + attribute->type, + attribute->stride, + base + attribute->offset)); + } + break; + case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY: +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + setup_generic_attribute (ctx, pipeline, attribute, base); + else +#endif + { + _cogl_bitmask_set (&ctx->enable_builtin_attributes_tmp, + COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY, TRUE); + GE (ctx, glNormalPointer (attribute->type, + attribute->stride, + base + attribute->offset)); + } + break; + case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY: +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + setup_generic_attribute (ctx, pipeline, attribute, base); + else +#endif + { + _cogl_bitmask_set (&ctx->enable_texcoord_attributes_tmp, + attribute->name_state->texture_unit, TRUE); + GE (ctx, + glClientActiveTexture (GL_TEXTURE0 + + attribute->name_state->texture_unit)); + GE (ctx, glTexCoordPointer (attribute->n_components, + attribute->type, + attribute->stride, + base + attribute->offset)); + } + break; + case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY: +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + setup_generic_attribute (ctx, pipeline, attribute, base); + else +#endif + { + _cogl_bitmask_set (&ctx->enable_builtin_attributes_tmp, + COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY, TRUE); + GE (ctx, glVertexPointer (attribute->n_components, + attribute->type, + attribute->stride, + base + attribute->offset)); + } + break; + case COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY: +#ifdef COGL_PIPELINE_PROGEND_GLSL + if (ctx->driver != COGL_DRIVER_GLES1) + setup_generic_attribute (ctx, pipeline, attribute, base); +#endif + break; + default: + g_warning ("Unrecognised attribute type 0x%08x", attribute->type); + } + + _cogl_buffer_unbind (buffer); + } + + apply_attribute_enable_updates (ctx, pipeline); + + if (copy) + cogl_object_unref (copy); +} + +void +_cogl_attribute_disable_cached_arrays (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _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/cogl-attribute.h b/cogl/cogl-attribute.h new file mode 100644 index 0000000..b59402c --- /dev/null +++ b/cogl/cogl-attribute.h @@ -0,0 +1,222 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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 + +G_BEGIN_DECLS + +/** + * SECTION:cogl-attribute + * @short_description: Functions for declaring and drawing vertex + * attributes + * + * FIXME + */ + +/** + * cogl_attribute_new: + * @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) + * + * + * 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. + * + * Returns: 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, + gsize stride, + gsize offset, + int components, + CoglAttributeType type); + +/** + * 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, + gboolean 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 + */ +gboolean +cogl_attribute_get_normalized (CoglAttribute *attribute); + +/** + * cogl_attribute_get_buffer: + * @attribute: A #CoglAttribute + * + * Return value: 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 handle references a #CoglAttribute, + * %FALSE otherwise + */ +gboolean +cogl_is_attribute (void *object); + +G_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..6a57dbf --- /dev/null +++ b/cogl/cogl-bitmap-conversion.c @@ -0,0 +1,621 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-private.h" +#include "cogl-bitmap-private.h" +#include "cogl-context-private.h" + +#include + +#define component_type guint8 +/* 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 + +#define component_type guint16 +#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 + +/* (Un)Premultiplication */ + +inline static void +_cogl_unpremult_alpha_0 (guint8 *dst) +{ + dst[0] = 0; + dst[1] = 0; + dst[2] = 0; + dst[3] = 0; +} + +inline static void +_cogl_unpremult_alpha_last (guint8 *dst) +{ + guint8 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 (guint8 *dst) +{ + guint8 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 (guint8 *dst) +{ + guint8 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 (guint8 *dst) +{ + guint8 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 (guint8 *p) +{ + /* 8 copies of 128 used below */ + static const gint16 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 gint8 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_guint8 (guint8 *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_guint8 (guint8 *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_guint16 (guint16 *data, + int width) +{ + while (width-- > 0) + { + guint16 alpha = data[3]; + + if (alpha == 0) + memset (data, 0, sizeof (guint16) * 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_guint16 (guint16 *data, + int width) +{ + while (width-- > 0) + { + guint16 alpha = data[3]; + + data[0] = (data[0] * alpha) / 65535; + data[1] = (data[1] * alpha) / 65535; + data[2] = (data[2] * alpha) / 65535; + } +} + +static gboolean +_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 gboolean +_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_ANY: + case COGL_PIXEL_FORMAT_YUV: + g_assert_not_reached (); + + case COGL_PIXEL_FORMAT_A_8: + 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 (); +} + +gboolean +_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp, + CoglBitmap *dst_bmp) +{ + guint8 *src_data; + guint8 *dst_data; + guint8 *src; + guint8 *dst; + void *tmp_row; + int src_rowstride; + int dst_rowstride; + int y; + int width, height; + CoglPixelFormat src_format; + CoglPixelFormat dst_format; + gboolean use_16; + gboolean 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)) + return FALSE; + + if (need_premult) + { + if ((dst_format & COGL_PREMULT_BIT)) + { + if (!_cogl_bitmap_premult (dst_bmp)) + return FALSE; + } + else + { + if (!_cogl_bitmap_unpremult (dst_bmp)) + return FALSE; + } + } + + return TRUE; + } + + src_data = _cogl_bitmap_map (src_bmp, COGL_BUFFER_ACCESS_READ, 0); + if (src_data == NULL) + return FALSE; + dst_data = _cogl_bitmap_map (dst_bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + 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 (guint16) : sizeof (guint8)) * 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_guint16 (src_format, src, tmp_row, width); + else + _cogl_unpack_guint8 (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_guint16 (tmp_row, width); + else + _cogl_bitmap_premult_unpacked_span_guint8 (tmp_row, width); + } + else + { + if (use_16) + _cogl_bitmap_unpremult_unpacked_span_guint16 (tmp_row, width); + else + _cogl_bitmap_unpremult_unpacked_span_guint8 (tmp_row, width); + } + } + + if (use_16) + _cogl_pack_guint16 (dst_format, tmp_row, dst, width); + else + _cogl_pack_guint8 (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) +{ + 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); + + if (!_cogl_bitmap_convert_into_bitmap (src_bmp, dst_bmp)) + { + cogl_object_unref (dst_bmp); + return NULL; + } + + return dst_bmp; +} + +gboolean +_cogl_bitmap_unpremult (CoglBitmap *bmp) +{ + guint8 *p, *data; + guint16 *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)) == 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 (guint16) * 4 * width); + + for (y = 0; y < height; y++) + { + p = (guint8*) data + y * rowstride; + + if (tmp_row) + { + _cogl_unpack_guint16 (format, p, tmp_row, width); + _cogl_bitmap_unpremult_unpacked_span_guint16 (tmp_row, width); + _cogl_pack_guint16 (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_guint8 (p, width); + } + } + + g_free (tmp_row); + + _cogl_bitmap_unmap (bmp); + + _cogl_bitmap_set_format (bmp, format & ~COGL_PREMULT_BIT); + + return TRUE; +} + +gboolean +_cogl_bitmap_premult (CoglBitmap *bmp) +{ + guint8 *p, *data; + guint16 *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)) == 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 (guint16) * 4 * width); + + for (y = 0; y < height; y++) + { + p = (guint8*) data + y * rowstride; + + if (tmp_row) + { + _cogl_unpack_guint16 (format, p, tmp_row, width); + _cogl_bitmap_premult_unpacked_span_guint16 (tmp_row, width); + _cogl_pack_guint16 (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_guint8 (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..6c0a985 --- /dev/null +++ b/cogl/cogl-bitmap-packing.h @@ -0,0 +1,718 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see . + * + * + */ + +/* This file is included multiple times with different definitions for + the component_type type (either guint8 or guint16). 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_type) (const guint8 *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_type) (const guint8 *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_rgb_888_, component_type) (const guint8 *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_type) (const guint8 *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_type) (const guint8 *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_type) (const guint8 *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_type) (const guint8 *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_type) (const guint8 *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_type) (const guint8 *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + guint16 v = *(const guint16 *) 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_type) (const guint8 *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + guint16 v = *(const guint16 *) 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_type) (const guint8 *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + guint16 v = *(const guint16 *) 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_type) (const guint8 *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + guint32 v = *(const guint32 *) 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_type) (const guint8 *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + guint32 v = *(const guint32 *) 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_type) (const guint8 *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + guint32 v = *(const guint32 *) 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_type) (const guint8 *src, + component_type *dst, + int width) +{ + while (width-- > 0) + { + guint32 v = *(const guint32 *) 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_type) (CoglPixelFormat format, + const guint8 *src, + component_type *dst, + int width) +{ + switch (format) + { + case COGL_PIXEL_FORMAT_A_8: + G_PASTE (_cogl_unpack_a_8_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_G_8: + G_PASTE (_cogl_unpack_g_8_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_888: + G_PASTE (_cogl_unpack_rgb_888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGR_888: + G_PASTE (_cogl_unpack_bgr_888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_RGBA_8888_PRE: + G_PASTE (_cogl_unpack_rgba_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888_PRE: + G_PASTE (_cogl_unpack_bgra_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ARGB_8888_PRE: + G_PASTE (_cogl_unpack_argb_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_8888: + case COGL_PIXEL_FORMAT_ABGR_8888_PRE: + G_PASTE (_cogl_unpack_abgr_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_565: + G_PASTE (_cogl_unpack_rgb_565_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_4444: + case COGL_PIXEL_FORMAT_RGBA_4444_PRE: + G_PASTE (_cogl_unpack_rgba_4444_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_5551: + case COGL_PIXEL_FORMAT_RGBA_5551_PRE: + G_PASTE (_cogl_unpack_rgba_5551_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_1010102: + case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: + G_PASTE (_cogl_unpack_rgba_1010102_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_1010102: + case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: + G_PASTE (_cogl_unpack_bgra_1010102_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_2101010: + case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: + G_PASTE (_cogl_unpack_argb_2101010_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_2101010: + case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: + G_PASTE (_cogl_unpack_abgr_2101010_, component_type) (src, dst, width); + break; + 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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + *dst = PACK_BYTE (src[3]); + src += 4; + dst++; + } +} + +inline static void +G_PASTE (_cogl_pack_g_8_, component_type) (const component_type *src, + guint8 *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_rgb_888_, component_type) (const component_type *src, + guint8 *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_type) (const component_type *src, + guint8 *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_type) (const component_type *src, + guint8 *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_type) (const component_type *src, + guint8 *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_type) (const component_type *src, + guint8 *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_type) (const component_type *src, + guint8 *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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + guint16 *v = (guint16 *) 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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + guint16 *v = (guint16 *) 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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + guint16 *v = (guint16 *) 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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + guint32 *v = (guint32 *) 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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + guint32 *v = (guint32 *) 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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + guint32 *v = (guint32 *) 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_type) (const component_type *src, + guint8 *dst, + int width) +{ + while (width-- > 0) + { + guint32 *v = (guint32 *) 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_type) (CoglPixelFormat format, + const component_type *src, + guint8 *dst, + int width) +{ + switch (format) + { + case COGL_PIXEL_FORMAT_A_8: + G_PASTE (_cogl_pack_a_8_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_G_8: + G_PASTE (_cogl_pack_g_8_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_888: + G_PASTE (_cogl_pack_rgb_888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGR_888: + G_PASTE (_cogl_pack_bgr_888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_8888: + case COGL_PIXEL_FORMAT_RGBA_8888_PRE: + G_PASTE (_cogl_pack_rgba_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_8888: + case COGL_PIXEL_FORMAT_BGRA_8888_PRE: + G_PASTE (_cogl_pack_bgra_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_8888: + case COGL_PIXEL_FORMAT_ARGB_8888_PRE: + G_PASTE (_cogl_pack_argb_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_8888: + case COGL_PIXEL_FORMAT_ABGR_8888_PRE: + G_PASTE (_cogl_pack_abgr_8888_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGB_565: + G_PASTE (_cogl_pack_rgb_565_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_4444: + case COGL_PIXEL_FORMAT_RGBA_4444_PRE: + G_PASTE (_cogl_pack_rgba_4444_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_5551: + case COGL_PIXEL_FORMAT_RGBA_5551_PRE: + G_PASTE (_cogl_pack_rgba_5551_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_RGBA_1010102: + case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: + G_PASTE (_cogl_pack_rgba_1010102_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_BGRA_1010102: + case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: + G_PASTE (_cogl_pack_bgra_1010102_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ARGB_2101010: + case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: + G_PASTE (_cogl_pack_argb_2101010_, component_type) (src, dst, width); + break; + case COGL_PIXEL_FORMAT_ABGR_2101010: + case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: + G_PASTE (_cogl_pack_abgr_2101010_, component_type) (src, dst, width); + break; + 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..3fa8b50 --- /dev/null +++ b/cogl/cogl-bitmap-pixbuf.c @@ -0,0 +1,306 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-internal.h" +#include "cogl-bitmap-private.h" +#include "cogl-context-private.h" + +#include + +#ifdef USE_QUARTZ +#include +#elif defined(USE_GDKPIXBUF) +#include +#endif + +#ifdef USE_QUARTZ + +gboolean +_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 (const char *filename, + GError **error) +{ + CFURLRef url; + CGImageSourceRef image_source; + CGImageRef image; + int save_errno; + CFStringRef type; + gsize width, height, rowstride; + guint8 *out_data; + CGColorSpaceRef color_space; + CGContextRef bitmap_context; + CoglBitmap *bmp; + + _COGL_GET_CONTEXT (ctx, NULL); + + g_assert (filename != NULL); + g_assert (error == NULL || *error == NULL); + + 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. */ + g_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); + g_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); + g_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); + rowstride = cogl_bitmap_get_rowstride (bmp); + out_data = _cogl_bitmap_map (bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + + /* render to buffer */ + color_space = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB); + bitmap_context = CGBitmapContextCreate (out_data, + width, height, 8, + rowstride, color_space, + kCGImageAlphaPremultipliedFirst); + CGColorSpaceRelease (color_space); + + { + 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) + +gboolean +_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 (const char *filename, + GError **error) +{ + static CoglUserDataKey pixbuf_key; + GdkPixbuf *pixbuf; + gboolean has_alpha; + GdkColorspace color_space; + CoglPixelFormat pixel_format; + int width; + int height; + int rowstride; + int bits_per_sample; + int n_channels; + CoglBitmap *bmp; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, FALSE); + + /* Load from file using GdkPixbuf */ + pixbuf = gdk_pixbuf_new_from_file (filename, error); + if (pixbuf == NULL) + 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" + +gboolean +_cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height) +{ + if (width) + *width = 0; + + if (height) + *height = 0; + + return TRUE; +} + +CoglBitmap * +_cogl_bitmap_from_file (const char *filename, + GError **error) +{ + static CoglUserDataKey bitmap_data_key; + CoglBitmap *bmp; + int stb_pixel_format; + int width; + int height; + guint8 *pixels; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, FALSE); + + /* Load from file using stb */ + pixels = stbi_load (filename, + &width, &height, &stb_pixel_format, + STBI_rgb_alpha); + if (pixels == NULL) + return FALSE; + + /* Store bitmap info */ + bmp = cogl_bitmap_new_for_data (ctx, + width, height, + COGL_PIXEL_FORMAT_RGBA_8888, + width * 4, /* rowstride */ + 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; +} +#endif diff --git a/cogl/cogl-bitmap-private.h b/cogl/cogl-bitmap-private.h new file mode 100644 index 0000000..fc93406 --- /dev/null +++ b/cogl/cogl-bitmap-private.h @@ -0,0 +1,145 @@ +/* + * Clutter COGL + * + * A basic GL/GLES Abstraction/Utility Layer + * + * Authored By Matthew Allum + * + * Copyright (C) 2007 OpenedHand + * + * 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, see . + * + * + */ + +#ifndef __COGL_BITMAP_H +#define __COGL_BITMAP_H + +#include + +#include "cogl-handle.h" +#include "cogl-buffer.h" +#include "cogl-bitmap.h" + +/* + * _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 + * + * 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); + +/* 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); + +gboolean +_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp, + CoglBitmap *dst_bmp); + +CoglBitmap * +_cogl_bitmap_from_file (const char *filename, + GError **error); + +gboolean +_cogl_bitmap_unpremult (CoglBitmap *dst_bmp); + +gboolean +_cogl_bitmap_premult (CoglBitmap *dst_bmp); + +gboolean +_cogl_bitmap_convert_premult_status (CoglBitmap *bmp, + CoglPixelFormat dst_format); + +gboolean +_cogl_bitmap_copy_subregion (CoglBitmap *src, + CoglBitmap *dst, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height); + +/* Creates a deep copy of the source bitmap */ +CoglBitmap * +_cogl_bitmap_copy (CoglBitmap *src_bmp); + +gboolean +_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 */ +guint8 * +_cogl_bitmap_map (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints); + +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 */ +guint8 * +_cogl_bitmap_bind (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints); + +void +_cogl_bitmap_unbind (CoglBitmap *bitmap); + +#endif /* __COGL_BITMAP_H */ diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c new file mode 100644 index 0000000..b0c6ec7 --- /dev/null +++ b/cogl/cogl-bitmap.c @@ -0,0 +1,476 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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 + +struct _CoglBitmap +{ + CoglHandleObject _parent; + CoglPixelFormat format; + int width; + int height; + int rowstride; + + guint8 *data; + + gboolean mapped; + gboolean 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; +}; + +static void _cogl_bitmap_free (CoglBitmap *bmp); + +COGL_OBJECT_DEFINE (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); +} + +gboolean +_cogl_bitmap_convert_premult_status (CoglBitmap *bmp, + CoglPixelFormat dst_format) +{ + /* 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); + + /* 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); + + return TRUE; +} + +CoglBitmap * +_cogl_bitmap_copy (CoglBitmap *src_bmp) +{ + 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); + + _COGL_GET_CONTEXT (ctx, NULL); + + dst_bmp = + _cogl_bitmap_new_with_malloc_buffer (ctx, + width, height, + src_format); + + _cogl_bitmap_copy_subregion (src_bmp, + dst_bmp, + 0, 0, /* src_x/y */ + 0, 0, /* dst_x/y */ + width, height); + + return dst_bmp; +} + +gboolean +_cogl_bitmap_copy_subregion (CoglBitmap *src, + CoglBitmap *dst, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + guint8 *srcdata; + guint8 *dstdata; + int bpp; + int line; + gboolean succeeded = FALSE; + + /* Intended only for fast copies when format is equal! */ + g_assert ((src->format & ~COGL_PREMULT_BIT) == + (dst->format & ~COGL_PREMULT_BIT)); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format); + + if ((srcdata = _cogl_bitmap_map (src, COGL_BUFFER_ACCESS_READ, 0))) + { + if ((dstdata = _cogl_bitmap_map (dst, COGL_BUFFER_ACCESS_WRITE, 0))) + { + srcdata += src_y * src->rowstride + src_x * bpp; + dstdata += dst_y * dst->rowstride + dst_x * bpp; + + for (line=0; linerowstride; + dstdata += dst->rowstride; + } + + succeeded = TRUE; + + _cogl_bitmap_unmap (dst); + } + + _cogl_bitmap_unmap (src); + } + + return succeeded; +} + +gboolean +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, + guint8 *data) +{ + CoglBitmap *bmp; + + g_return_val_if_fail (cogl_is_context (context), NULL); + + bmp = g_slice_new (CoglBitmap); + 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) +{ + static CoglUserDataKey bitmap_free_key; + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + int rowstride = ((width * bpp) + 3) & ~3; + guint8 *data = g_malloc (rowstride * height); + CoglBitmap *bitmap; + + 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; + + _COGL_GET_CONTEXT (ctx, NULL); + + bmp = cogl_bitmap_new_for_data (ctx, + 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, + GError **error) +{ + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, COGL_INVALID_HANDLE); + + return _cogl_bitmap_from_file (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 */ + if (G_UNLIKELY (format == COGL_PIXEL_FORMAT_ANY)) + return 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); + + if (G_UNLIKELY (pixel_buffer == NULL)) + return NULL; + + bitmap = cogl_bitmap_new_from_buffer (COGL_BUFFER (pixel_buffer), + format, + width, height, + rowstride, + 0 /* offset */); + + cogl_object_unref (pixel_buffer); + + return bitmap; +} + +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); +} + +GQuark +cogl_bitmap_error_quark (void) +{ + return g_quark_from_static_string ("cogl-bitmap-error-quark"); +} + +guint8 * +_cogl_bitmap_map (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints) +{ + /* Divert to another bitmap if this data is shared */ + if (bitmap->shared_bmp) + return _cogl_bitmap_map (bitmap->shared_bmp, access, hints); + + g_assert (!bitmap->mapped); + + if (bitmap->buffer) + { + guint8 *data = cogl_buffer_map (bitmap->buffer, + access, + hints); + + 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); +} + +guint8 * +_cogl_bitmap_bind (CoglBitmap *bitmap, + CoglBufferAccess access, + CoglBufferMapHint hints) +{ + guint8 *ptr; + + /* Divert to another bitmap if this data is shared */ + if (bitmap->shared_bmp) + return _cogl_bitmap_bind (bitmap->shared_bmp, access, hints); + + g_assert (!bitmap->bound); + + /* If the bitmap wasn't created from a buffer then the + implementation of bind is the same as map */ + if (bitmap->buffer == NULL) + { + guint8 *data = _cogl_bitmap_map (bitmap, access, hints); + if (data) + bitmap->bound = TRUE; + return data; + } + + bitmap->bound = TRUE; + + if (access == COGL_BUFFER_ACCESS_READ) + ptr = _cogl_buffer_bind (bitmap->buffer, + COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK); + else if (access == COGL_BUFFER_ACCESS_WRITE) + ptr = _cogl_buffer_bind (bitmap->buffer, + COGL_BUFFER_BIND_TARGET_PIXEL_PACK); + else + g_assert_not_reached (); + + /* The data pointer actually stores the offset */ + return GPOINTER_TO_INT (bitmap->data) + ptr; +} + +void +_cogl_bitmap_unbind (CoglBitmap *bitmap) +{ + /* Divert to another bitmap if this data is shared */ + if (bitmap->shared_bmp) + { + _cogl_bitmap_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_unbind (bitmap->buffer); + else + _cogl_bitmap_unmap (bitmap); +} diff --git a/cogl/cogl-bitmap.h b/cogl/cogl-bitmap.h new file mode 100644 index 0000000..e2e2962 --- /dev/null +++ b/cogl/cogl-bitmap.h @@ -0,0 +1,288 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_BITMAP_H__ +#define __COGL_BITMAP_H__ + +#include +#include +#include +#include + +G_BEGIN_DECLS + +typedef struct _CoglBitmap CoglBitmap; + +/** + * SECTION:cogl-bitmap + * @short_description: Fuctions 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 #GError or %NULL. + * + * Loads an image file from disk. This function can be safely called from + * within a thread. + * + * Return value: 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, + GError **error); + +#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: 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_pixel_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: 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: A new #CoglBitmap. + * Since: 1.10 + * Stability: unstable + */ +CoglBitmap * +cogl_bitmap_new_for_data (CoglContext *context, + int width, + int height, + CoglPixelFormat format, + int rowstride, + guint8 *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: 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 + */ +gboolean +cogl_bitmap_get_size_from_file (const char *filename, + int *width, + int *height); + +/** + * cogl_is_bitmap: + * @handle: a #CoglHandle for a bitmap + * + * Checks whether @handle is a #CoglHandle for a bitmap + * + * Return value: %TRUE if the passed handle represents a bitmap, + * and %FALSE otherwise + * + * Since: 1.0 + */ +gboolean +cogl_is_bitmap (CoglHandle handle); + +/** + * COGL_BITMAP_ERROR: + * + * #GError 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; + +GQuark cogl_bitmap_error_quark (void); + +G_END_DECLS + +#endif /* __COGL_BITMAP_H__ */ diff --git a/cogl/cogl-bitmask.c b/cogl/cogl-bitmask.c new file mode 100644 index 0000000..1d2f2f8 --- /dev/null +++ b/cogl/cogl-bitmask.c @@ -0,0 +1,311 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#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 */ +G_STATIC_ASSERT (sizeof (unsigned long) <= sizeof (void *)); + +#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)) + +gboolean +_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, + gboolean 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, + gboolean 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)); + } +} diff --git a/cogl/cogl-bitmask.h b/cogl/cogl-bitmask.h new file mode 100644 index 0000000..7c15e1b --- /dev/null +++ b/cogl/cogl-bitmask.h @@ -0,0 +1,307 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_BITMASK_H +#define __COGL_BITMASK_H + +#include +#include "cogl-util.h" + +G_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 + +gboolean +_cogl_bitmask_get_from_array (const CoglBitmask *bitmask, + unsigned int bit_num); + +void +_cogl_bitmask_set_in_array (CoglBitmask *bitmask, + unsigned int bit_num, + gboolean value); + +void +_cogl_bitmask_set_range_in_array (CoglBitmask *bitmask, + unsigned int n_bits, + gboolean 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 gboolean (* 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 gboolean +_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, gboolean 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, + gboolean 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)); +} + +G_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..50d32f2 --- /dev/null +++ b/cogl/cogl-blend-string.c @@ -0,0 +1,1011 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-debug.h" +#include "cogl-blend-string.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 + +GQuark +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 gboolean +validate_tex_combine_statements (CoglBlendStringStatement *statements, + int n_statements, + GError **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: + g_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 gboolean +validate_blend_statements (CoglBlendStringStatement *statements, + int n_statements, + GError **error) +{ + int i, j; + const char *error_string; + CoglBlendStringError detail = COGL_BLEND_STRING_ERROR_INVALID_ERROR; + + _COGL_GET_CONTEXT (ctx, 0); + + if (ctx->driver == COGL_DRIVER_GL) + { + if (n_statements == 2) + { + /* glBlendEquationSeperate is GL 2.0 only */ + if (!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; + } + } + } + else if (ctx->driver == COGL_DRIVER_GLES1) + { + if (n_statements != 1) + { + error_string = "Separate blend functions for the RGB an A " + "channels isn't supported by the GLES 1"; + 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 (ctx->driver == COGL_DRIVER_GLES1 && + arg->factor.is_color && + (arg->factor.source.info->type == + COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT)) + { + error_string = "GLES Doesn't support constant blend factors"; + detail = COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR; + goto error; + } + } + + return TRUE; + +error: + g_set_error (error, + COGL_BLEND_STRING_ERROR, + detail, + "Invalid blend string: %s", + error_string); + return FALSE; +} + +static gboolean +validate_statements_for_context (CoglBlendStringStatement *statements, + int n_statements, + CoglBlendStringContext context, + GError **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: + g_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) +{ + gsize len = p - mark; + CoglBlendStringFunctionInfo *functions; + gsize 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) +{ + gsize len = p - mark; + CoglBlendStringColorSourceInfo *sources; + gsize 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 gboolean +is_symbol_char (const char c) +{ + return (g_ascii_isalpha (c) || c == '_') ? TRUE : FALSE; +} + +static gboolean +is_alphanum_char (const char c) +{ + return (g_ascii_isalnum (c) || c == '_') ? TRUE : FALSE; +} + +static gboolean +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, + GError **error) +{ + const char *p = *ret_p; + const char *mark = NULL; + const char *error_string = NULL; + ParserArgState state = PARSER_ARG_STATE_START; + gboolean parsing_factor = FALSE; + gboolean 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 == ']') + { + gsize 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)) + { + gsize 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; + g_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, + GError **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; + g_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; + + GError *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); + g_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..99fe407 --- /dev/null +++ b/cogl/cogl-blend-string.h @@ -0,0 +1,137 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + * + * 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; + gsize name_len; +} CoglBlendStringColorSourceInfo; + +typedef struct _CoglBlendStringColorSource +{ + gboolean is_zero; + const CoglBlendStringColorSourceInfo *info; + int texture; /* for the TEXTURE_N color source */ + gboolean one_minus; + CoglBlendStringChannelMask mask; +} CoglBlendStringColorSource; + +typedef struct _CoglBlendStringFactor +{ + gboolean is_one; + gboolean is_src_alpha_saturate; + gboolean 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; + gsize name_len; + int argc; +} CoglBlendStringFunctionInfo; + +typedef struct _CoglBlendStringStatement +{ + CoglBlendStringChannelMask mask; + const CoglBlendStringFunctionInfo *function; + CoglBlendStringArgument args[3]; +} CoglBlendStringStatement; + + +gboolean +_cogl_blend_string_compile (const char *string, + CoglBlendStringContext context, + CoglBlendStringStatement *statements, + GError **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..56c0c14 --- /dev/null +++ b/cogl/cogl-blit.c @@ -0,0 +1,423 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * 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-2d-private.h" +#include "cogl-private.h" +#include "cogl1-context.h" + +static const CoglBlitMode *_cogl_blit_default_mode = NULL; + +static gboolean +_cogl_blit_texture_render_begin (CoglBlitData *data) +{ + CoglHandle fbo; + CoglPipeline *pipeline; + unsigned int dst_width, dst_height; + + _COGL_GET_CONTEXT (ctx, FALSE); + + fbo = _cogl_offscreen_new_to_texture_full + (data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */); + + if (fbo == COGL_INVALID_HANDLE) + return FALSE; + + if (!cogl_framebuffer_allocate (fbo, NULL)) + { + cogl_handle_unref (fbo); + return FALSE; + } + + cogl_push_framebuffer (fbo); + cogl_handle_unref (fbo); + + 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_ortho (0, /* left */ + dst_width, /* right */ + dst_height, /* bottom */ + 0, /* top */ + -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); + + _cogl_push_source (pipeline, FALSE); + + return TRUE; +} + +static void +_cogl_blit_texture_render_blit (CoglBlitData *data, + unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned int height) +{ + cogl_rectangle_with_texture_coords (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) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl_pop_source (); + cogl_pop_framebuffer (); + + /* 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); +} + +static gboolean +_cogl_blit_framebuffer_begin (CoglBlitData *data) +{ + CoglHandle dst_fbo, src_fbo; + gboolean ret; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* 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) || + !(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)) + return FALSE; + + dst_fbo = _cogl_offscreen_new_to_texture_full + (data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */); + + if (dst_fbo == COGL_INVALID_HANDLE) + ret = FALSE; + else + { + if (!cogl_framebuffer_allocate (dst_fbo, NULL)) + ret = FALSE; + else + { + src_fbo = _cogl_offscreen_new_to_texture_full + (data->src_tex, + COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, + 0 /* level */); + + if (src_fbo == COGL_INVALID_HANDLE) + ret = FALSE; + else + { + if (!cogl_framebuffer_allocate (src_fbo, NULL)) + ret = FALSE; + else + _cogl_push_framebuffers (dst_fbo, src_fbo); + + cogl_handle_unref (src_fbo); + } + } + + cogl_handle_unref (dst_fbo); + } + + return ret; +} + +static void +_cogl_blit_framebuffer_blit (CoglBlitData *data, + unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned int height) +{ + _cogl_blit_framebuffer (src_x, src_y, + dst_x, dst_y, + width, height); +} + +static void +_cogl_blit_framebuffer_end (CoglBlitData *data) +{ + cogl_pop_framebuffer (); +} + +static gboolean +_cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data) +{ + CoglHandle fbo; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* This will only work if the target texture is a CoglTexture2D */ + if (!cogl_is_texture_2d (data->dst_tex)) + return FALSE; + + fbo = _cogl_offscreen_new_to_texture_full + (data->src_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */); + + if (fbo == COGL_INVALID_HANDLE) + return FALSE; + + if (!cogl_framebuffer_allocate (fbo, NULL)) + { + cogl_handle_unref (fbo); + return FALSE; + } + + cogl_push_framebuffer (fbo); + cogl_handle_unref (fbo); + + return TRUE; +} + +static void +_cogl_blit_copy_tex_sub_image_blit (CoglBlitData *data, + unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned int height) +{ + _cogl_texture_2d_copy_from_framebuffer (data->dst_tex, + dst_x, dst_y, + src_x, src_y, + width, height); +} + +static void +_cogl_blit_copy_tex_sub_image_end (CoglBlitData *data) +{ + cogl_pop_framebuffer (); +} + +static gboolean +_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, + unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned int height) +{ + cogl_texture_set_region (data->dst_tex, + src_x, src_y, + dst_x, dst_y, + width, height, + data->src_width, data->src_height, + data->format, + data->src_width * data->bpp, + data->image_data); +} + +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, + CoglHandle dst_tex, + CoglHandle 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; + } + + 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, + unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned 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..95e708e --- /dev/null +++ b/cogl/cogl-blit.h @@ -0,0 +1,89 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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 __COGL_BLIT_H +#define __COGL_BLIT_H + +#include +#include "cogl-handle.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 gboolean (* CoglBlitBeginFunc) (CoglBlitData *data); +typedef void (* CoglBlitEndFunc) (CoglBlitData *data); + +typedef void (* CoglBlitFunc) (CoglBlitData *data, + unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned int height); + +typedef struct +{ + const char *name; + CoglBlitBeginFunc begin_func; + CoglBlitFunc blit_func; + CoglBlitEndFunc end_func; +} CoglBlitMode; + +struct _CoglBlitData +{ + CoglHandle 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; +}; + +void +_cogl_blit_begin (CoglBlitData *data, + CoglHandle dst_tex, + CoglHandle src_tex); + +void +_cogl_blit (CoglBlitData *data, + unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned 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..b2cb3f3 --- /dev/null +++ b/cogl/cogl-boxed-value.c @@ -0,0 +1,336 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-boxed-value.h" +#include "cogl-context-private.h" + +gboolean +_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 || + bva->transpose != bvb->transpose) + 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_set_x (CoglBoxedValue *bv, + int size, + int count, + CoglBoxedType type, + gsize value_size, + gconstpointer value, + gboolean transpose) +{ + if (count == 1) + { + if (bv->count > 1) + g_free (bv->v.array); + + 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); + + memcpy (bv->v.array, value, count * value_size); + } + + bv->type = type; + bv->size = size; + bv->count = count; + bv->transpose = transpose; +} + +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, + gboolean 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, + value->transpose, ptr) ); + break; + case 3: + GE( ctx, glUniformMatrix3fv (location, value->count, + value->transpose, ptr) ); + break; + case 4: + GE( ctx, glUniformMatrix4fv (location, value->count, + value->transpose, ptr) ); + break; + } + } + break; + } +} diff --git a/cogl/cogl-boxed-value.h b/cogl/cogl-boxed-value.h new file mode 100644 index 0000000..d9dd45a --- /dev/null +++ b/cogl/cogl-boxed-value.h @@ -0,0 +1,111 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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; + gboolean transpose; + + 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 + +gboolean +_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, + gboolean 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..62bcf45 --- /dev/null +++ b/cogl/cogl-buffer-private.h @@ -0,0 +1,160 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * 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" + +G_BEGIN_DECLS + +typedef struct _CoglBufferVtable CoglBufferVtable; + +struct _CoglBufferVtable +{ + void * (* map) (CoglBuffer *buffer, + CoglBufferAccess access, + CoglBufferMapHint hints); + + void (* unmap) (CoglBuffer *buffer); + + gboolean (* set_data) (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size); +}; + +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; + + guint8 *data; /* points to the mapped memory when + * the CoglBuffer is a VBO, PBO, ... or + * points to allocated memory in the + * fallback paths */ + + int immutable_ref; + + guint 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, + unsigned int size, + gboolean use_malloc, + CoglBufferBindTarget default_target, + CoglBufferUsageHint usage_hint, + CoglBufferUpdateHint update_hint); + +void +_cogl_buffer_fini (CoglBuffer *buffer); + +void * +_cogl_buffer_bind (CoglBuffer *buffer, + CoglBufferBindTarget target); + +void +_cogl_buffer_unbind (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); + +/* This is a wrapper around cogl_buffer_map 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_for_fill_or_fallback (CoglBuffer *buffer); + +void +_cogl_buffer_unmap_for_fill_or_fallback (CoglBuffer *buffer); + +G_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..f5a0fc5 --- /dev/null +++ b/cogl/cogl-buffer.c @@ -0,0 +1,542 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * 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-internal.h" +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-handle.h" +#include "cogl-pixel-buffer-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 + +/* XXX: + * The CoglHandle 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); +} + +gboolean +cogl_is_buffer (void *object) +{ + const CoglHandleObject *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; +} + +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 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; +} + +static GLenum +_cogl_buffer_hints_to_gl_enum (CoglBufferUsageHint usage_hint, + CoglBufferUpdateHint update_hint) +{ + /* usage hint is always TEXTURE for now */ + if (update_hint == COGL_BUFFER_UPDATE_HINT_STATIC) + return GL_STATIC_DRAW; + if (update_hint == COGL_BUFFER_UPDATE_HINT_DYNAMIC) + return GL_DYNAMIC_DRAW; + /* OpenGL ES 1.1 and 2 only know about STATIC_DRAW and DYNAMIC_DRAW */ +#ifdef HAVE_COGL_GL + if (update_hint == COGL_BUFFER_UPDATE_HINT_STREAM) + return GL_STREAM_DRAW; +#endif + + return GL_STATIC_DRAW; +} + +static void +bo_recreate_store (CoglBuffer *buffer) +{ + GLenum gl_target; + GLenum gl_enum; + + /* This assumes the buffer is already bound */ + + gl_target = convert_bind_target_to_gl_target (buffer->last_target); + gl_enum = _cogl_buffer_hints_to_gl_enum (buffer->usage_hint, + buffer->update_hint); + + GE( buffer->context, glBufferData (gl_target, + buffer->size, + NULL, + gl_enum) ); + buffer->store_created = TRUE; +} + +static void * +bo_map (CoglBuffer *buffer, + CoglBufferAccess access, + CoglBufferMapHint hints) +{ + guint8 *data; + CoglBufferBindTarget target; + GLenum gl_target; + CoglContext *ctx = buffer->context; + + if ((access & COGL_BUFFER_ACCESS_READ) && + !cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_READ)) + return NULL; + if ((access & COGL_BUFFER_ACCESS_WRITE) && + !cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE)) + return NULL; + + target = buffer->last_target; + _cogl_buffer_bind_no_create (buffer, target); + + gl_target = convert_bind_target_to_gl_target (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->store_created || (hints & COGL_BUFFER_MAP_HINT_DISCARD)) + bo_recreate_store (buffer); + + GE_RET( data, ctx, glMapBuffer (gl_target, + _cogl_buffer_access_to_gl_enum (access)) ); + if (data) + buffer->flags |= COGL_BUFFER_FLAG_MAPPED; + + _cogl_buffer_unbind (buffer); + + return data; +} + +static void +bo_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_unbind (buffer); +} + +static gboolean +bo_set_data (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size) +{ + CoglBufferBindTarget target; + GLenum gl_target; + CoglContext *ctx = buffer->context; + + target = buffer->last_target; + _cogl_buffer_bind (buffer, target); + + gl_target = convert_bind_target_to_gl_target (target); + + GE( ctx, glBufferSubData (gl_target, offset, size, data) ); + + _cogl_buffer_unbind (buffer); + + return TRUE; +} + +/* + * Fallback path, buffer->data points to a malloc'ed buffer. + */ + +static void * +malloc_map (CoglBuffer *buffer, + CoglBufferAccess access, + CoglBufferMapHint hints) +{ + buffer->flags |= COGL_BUFFER_FLAG_MAPPED; + return buffer->data; +} + +static void +malloc_unmap (CoglBuffer *buffer) +{ + buffer->flags &= ~COGL_BUFFER_FLAG_MAPPED; +} + +static gboolean +malloc_set_data (CoglBuffer *buffer, + unsigned int offset, + const void *data, + unsigned int size) +{ + memcpy (buffer->data + offset, data, size); + return TRUE; +} + +void +_cogl_buffer_initialize (CoglBuffer *buffer, + CoglContext *context, + unsigned int size, + gboolean use_malloc, + CoglBufferBindTarget default_target, + CoglBufferUsageHint usage_hint, + CoglBufferUpdateHint update_hint) +{ + buffer->context = cogl_object_ref (context); + 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 (use_malloc) + { + buffer->vtable.map = malloc_map; + buffer->vtable.unmap = malloc_unmap; + buffer->vtable.set_data = malloc_set_data; + + buffer->data = g_malloc (size); + } + else + { + buffer->vtable.map = bo_map; + buffer->vtable.unmap = bo_unmap; + buffer->vtable.set_data = bo_set_data; + + GE( context, glGenBuffers (1, &buffer->gl_handle) ); + 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) + GE( buffer->context, glDeleteBuffers (1, &buffer->gl_handle) ); + else + g_free (buffer->data); + + cogl_object_unref (buffer->context); +} + +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; +} + +void * +_cogl_buffer_bind (CoglBuffer *buffer, CoglBufferBindTarget target) +{ + 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) + bo_recreate_store (buffer); + + return ret; +} + +void +_cogl_buffer_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; +} + +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 gboolean 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) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); + + if (G_UNLIKELY (buffer->immutable_ref)) + warn_about_midscene_changes (); + + if (buffer->flags & COGL_BUFFER_FLAG_MAPPED) + return buffer->data; + + buffer->data = buffer->vtable.map (buffer, access, hints); + 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) +{ + CoglContext *ctx = buffer->context; + void *ret; + + _COGL_RETURN_VAL_IF_FAIL (!ctx->buffer_map_fallback_in_use, NULL); + + ctx->buffer_map_fallback_in_use = TRUE; + + ret = cogl_buffer_map (buffer, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + + if (ret) + return ret; + else + { + /* 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, buffer->size); + + 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)) + { + cogl_buffer_set_data (buffer, 0, + ctx->buffer_map_fallback_array->data, + buffer->size); + buffer->flags &= ~COGL_BUFFER_FLAG_MAPPED_FALLBACK; + } + else + cogl_buffer_unmap (buffer); +} + +gboolean +cogl_buffer_set_data (CoglBuffer *buffer, + gsize offset, + const void *data, + gsize size) +{ + _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); +} + +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..ffd8968 --- /dev/null +++ b/cogl/cogl-buffer.h @@ -0,0 +1,242 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C)2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_BUFFER_H__ +#define __COGL_BUFFER_H__ + +#include +#include + +G_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. + */ + +#define COGL_BUFFER(buffer) ((CoglBuffer *)(buffer)) + +typedef struct _CoglBuffer CoglBuffer; + +/** + * 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 + */ +gboolean +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. + * + * 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 +} 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. + * + * 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: 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_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 + */ +gboolean +cogl_buffer_set_data (CoglBuffer *buffer, + gsize offset, + const void *data, + gsize size); + +G_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..ef64893 --- /dev/null +++ b/cogl/cogl-clip-stack.c @@ -0,0 +1,995 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#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-internal.h" +#include "cogl-framebuffer-private.h" +#include "cogl-journal-private.h" +#include "cogl-util.h" +#include "cogl-path-private.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" + +#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, + GLint plane_num, + const float *vertex_a, + const float *vertex_b) +{ + GLfloat planef[4]; + double planed[4]; + GLfloat angle; + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + CoglMatrix inverse_projection; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _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_stack_flush_to_gl_builtins (ctx, + modelview_stack, + COGL_MATRIX_MODELVIEW, + 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: + 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, + float x_1, + float y_1, + float x_2, + float y_2) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + 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_stack_get (modelview_stack, &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, + float x_1, + float y_1, + float x_2, + float y_2, + gboolean first) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); + + /* This can be called from the journal code which doesn't flush + the matrix stacks between calls so we need to ensure they're + flushed now */ + _cogl_context_set_current_projection (ctx, projection_stack); + _cogl_context_set_current_modelview (ctx, modelview_stack); + + 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_matrix_stack_push (projection_stack); + _cogl_matrix_stack_load_identity (projection_stack); + + _cogl_matrix_stack_push (modelview_stack); + _cogl_matrix_stack_load_identity (modelview_stack); + + _cogl_context_set_current_projection (ctx, projection_stack); + _cogl_context_set_current_modelview (ctx, modelview_stack); + + _cogl_rectangle_immediate (framebuffer, + ctx->stencil_pipeline, + -1.0, -1.0, 1.0, 1.0); + + _cogl_matrix_stack_pop (modelview_stack); + _cogl_matrix_stack_pop (projection_stack); + } + + /* Restore the stencil mode */ + GE( ctx, glStencilFunc (GL_EQUAL, 0x1, 0x1) ); + GE( ctx, glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP) ); +} + +typedef void (*SilhouettePaintCallback) (void *user_data); + +static void +add_stencil_clip_silhouette (CoglFramebuffer *framebuffer, + SilhouettePaintCallback silhouette_callback, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2, + gboolean merge, + gboolean need_clear, + void *user_data) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); + + /* This can be called from the clip stack code which doesn't flush + the matrix stacks between calls so we need to ensure they're + flushed now */ + _cogl_context_set_current_projection (ctx, projection_stack); + _cogl_context_set_current_modelview (ctx, modelview_stack); + + _cogl_pipeline_flush_gl_state (ctx->stencil_pipeline, FALSE, 0); + + 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 (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_matrix_stack_push (projection_stack); + _cogl_matrix_stack_load_identity (projection_stack); + + _cogl_matrix_stack_push (modelview_stack); + _cogl_matrix_stack_load_identity (modelview_stack); + + _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); + + _cogl_matrix_stack_pop (modelview_stack); + _cogl_matrix_stack_pop (projection_stack); + } + + 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_path_silhouette (void *user_data) +{ + CoglPath *path = user_data; + if (path->data->path_nodes->len >= 3) + _cogl_path_fill_nodes (path, + COGL_DRAW_SKIP_JOURNAL_FLUSH | + COGL_DRAW_SKIP_PIPELINE_VALIDATION | + COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH); +} + +static void +add_stencil_clip_path (CoglFramebuffer *framebuffer, + CoglPath *path, + gboolean merge, + gboolean need_clear) +{ + CoglPathData *data = path->data; + add_stencil_clip_silhouette (framebuffer, + paint_path_silhouette, + data->path_nodes_min.x, + data->path_nodes_min.y, + data->path_nodes_max.x, + data->path_nodes_max.y, + merge, + need_clear, + path); +} + +static void +paint_primitive_silhouette (void *user_data) +{ + _cogl_framebuffer_draw_primitive (cogl_get_draw_framebuffer (), + cogl_get_source (), + user_data, + 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, + CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2, + gboolean merge, + gboolean need_clear) +{ + add_stencil_clip_silhouette (framebuffer, + paint_primitive_silhouette, + bounds_x1, + bounds_y1, + bounds_x2, + bounds_y2, + merge, + need_clear, + primitive); +} + +static void +disable_stencil_buffer (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + GE( ctx, glDisable (GL_STENCIL_TEST) ); +} + +static void +enable_clip_planes (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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 (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + GE( ctx, glDisable (GL_CLIP_PLANE3) ); + GE( ctx, glDisable (GL_CLIP_PLANE2) ); + GE( ctx, glDisable (GL_CLIP_PLANE1) ); + GE( ctx, glDisable (GL_CLIP_PLANE0) ); +} + +static gpointer +_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; +} + +/* 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 x_1, + float y_1, + float x_2, + float y_2, + const CoglMatrix *modelview) +{ + CoglMatrix projection; + float viewport[4]; + float verts[4 * 2] = { x_1, y_1, x_2, y_1, x_2, y_2, x_1, y_2 }; + float min_x = G_MAXFLOAT, min_y = G_MAXFLOAT; + float max_x = -G_MAXFLOAT, max_y = -G_MAXFLOAT; + int i; + + cogl_get_projection_matrix (&projection); + cogl_get_viewport (viewport); + + for (i = 0; i < 4; i++) + { + float *v = verts + i * 2; + + /* Project the coordinates to window space coordinates */ + _cogl_transform_point (modelview, &projection, viewport, v, v + 1); + + 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, + const CoglMatrix *modelview_matrix) +{ + CoglClipStackRect *entry; + CoglMatrix matrix_p; + float v[4]; + + /* 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 = *modelview_matrix; + + /* If the modelview meets these constraints then a transformed rectangle + * should still be a rectangle when it reaches screen coordinates. + * + * FIXME: we are are making certain assumptions about the projection + * matrix a.t.m and should really be looking at the combined modelview + * and projection matrix. + * FIXME: we don't consider rotations that are a multiple of 90 degrees + * which could be quite common. + */ + if (modelview_matrix->xy != 0 || modelview_matrix->xz != 0 || + modelview_matrix->yx != 0 || modelview_matrix->yz != 0 || + modelview_matrix->zx != 0 || modelview_matrix->zy != 0) + { + entry->can_be_scissor = FALSE; + _cogl_clip_stack_entry_set_bounds ((CoglClipStack *) entry, + x_1, y_1, x_2, y_2, modelview_matrix); + } + else + { + CoglClipStack *base_entry = (CoglClipStack *) entry; + + cogl_get_projection_matrix (&matrix_p); + cogl_get_viewport (v); + + _cogl_transform_point (modelview_matrix, &matrix_p, v, &x_1, &y_1); + _cogl_transform_point (modelview_matrix, &matrix_p, v, &x_2, &y_2); + + /* 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_from_path (CoglClipStack *stack, + CoglPath *path, + const CoglMatrix *modelview_matrix) +{ + 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_matrix); + else + { + CoglClipStackPath *entry; + + entry = _cogl_clip_stack_push_entry (stack, + sizeof (CoglClipStackPath), + COGL_CLIP_STACK_PATH); + + entry->path = cogl_path_copy (path); + + entry->matrix = *modelview_matrix; + + _cogl_clip_stack_entry_set_bounds ((CoglClipStack *) entry, + x_1, y_1, x_2, y_2, modelview_matrix); + + 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, + const CoglMatrix *modelview_matrix) +{ + CoglClipStackPrimitive *entry; + + entry = _cogl_clip_stack_push_entry (stack, + sizeof (CoglClipStackPrimitive), + COGL_CLIP_STACK_PRIMITIVE); + + entry->primitive = cogl_object_ref (primitive); + + entry->matrix = *modelview_matrix; + + entry->bounds_x1 = bounds_x1; + entry->bounds_y1 = bounds_y1; + entry->bounds_x2 = bounds_x2; + entry->bounds_y2 = bounds_y2; + + /* 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, + bounds_x1, bounds_y1, bounds_x2, bounds_y2, + modelview_matrix); + + 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: + g_slice_free1 (sizeof (CoglClipStackRect), entry); + break; + + case COGL_CLIP_STACK_WINDOW_RECT: + g_slice_free1 (sizeof (CoglClipStackWindowRect), entry); + break; + + case COGL_CLIP_STACK_PATH: + cogl_object_unref (((CoglClipStackPath *) entry)->path); + g_slice_free1 (sizeof (CoglClipStackPath), entry); + break; + + case COGL_CLIP_STACK_PRIMITIVE: + cogl_object_unref (((CoglClipStackPrimitive *) 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 */ + *scissor_x0 = MAX (*scissor_x0, entry->bounds_x0); + *scissor_y0 = MAX (*scissor_y0, entry->bounds_y0); + *scissor_x1 = MIN (*scissor_x1, entry->bounds_x1); + *scissor_y1 = MIN (*scissor_y1, entry->bounds_y1); + } +} + +void +_cogl_clip_stack_flush (CoglClipStack *stack, + CoglFramebuffer *framebuffer) +{ + int has_clip_planes; + gboolean using_clip_planes = FALSE; + gboolean using_stencil_buffer = FALSE; + int scissor_x0; + int scissor_y0; + int scissor_x1; + int scissor_y1; + CoglMatrixStack *modelview_stack; + CoglClipStack *entry; + int scissor_y_start; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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) + return; + + _cogl_clip_stack_unref (ctx->current_clip_stack); + } + + ctx->current_clip_stack_valid = TRUE; + ctx->current_clip_stack = _cogl_clip_stack_ref (stack); + + modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + + has_clip_planes = + ctx->private_feature_flags & COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES; + + if (has_clip_planes) + disable_clip_planes (); + disable_stencil_buffer (); + + /* If the stack is empty then there's nothing else to do */ + if (stack == NULL) + { + 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); + + /* 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_PATH: + { + CoglClipStackPath *path_entry = (CoglClipStackPath *) entry; + + COGL_NOTE (CLIPPING, "Adding stencil clip for path"); + + _cogl_matrix_stack_push (modelview_stack); + _cogl_matrix_stack_set (modelview_stack, &path_entry->matrix); + + add_stencil_clip_path (framebuffer, + path_entry->path, + using_stencil_buffer, + TRUE); + + _cogl_matrix_stack_pop (modelview_stack); + + using_stencil_buffer = TRUE; + break; + } + case COGL_CLIP_STACK_PRIMITIVE: + { + CoglClipStackPrimitive *primitive_entry = + (CoglClipStackPrimitive *) entry; + + COGL_NOTE (CLIPPING, "Adding stencil clip for primitive"); + + _cogl_matrix_stack_push (modelview_stack); + _cogl_matrix_stack_set (modelview_stack, &primitive_entry->matrix); + + add_stencil_clip_primitive (framebuffer, + primitive_entry->primitive, + primitive_entry->bounds_x1, + primitive_entry->bounds_y1, + primitive_entry->bounds_x2, + primitive_entry->bounds_y2, + using_stencil_buffer, + TRUE); + + _cogl_matrix_stack_pop (modelview_stack); + + 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) + { + _cogl_matrix_stack_push (modelview_stack); + _cogl_matrix_stack_set (modelview_stack, &rect->matrix); + + /* 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->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->x0, + rect->y0, + rect->x1, + rect->y1, + !using_stencil_buffer); + using_stencil_buffer = TRUE; + } + + _cogl_matrix_stack_pop (modelview_stack); + } + 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->current_clip_stack_uses_stencil = using_stencil_buffer; +} diff --git a/cogl/cogl-clip-stack.h b/cogl/cogl-clip-stack.h new file mode 100644 index 0000000..c263caa --- /dev/null +++ b/cogl/cogl-clip-stack.h @@ -0,0 +1,219 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_CLIP_STACK_H +#define __COGL_CLIP_STACK_H + +#include "cogl2-path.h" +#include "cogl-matrix.h" +#include "cogl-primitive.h" +#include "cogl-framebuffer.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 _CoglClipStackPath CoglClipStackPath; +typedef struct _CoglClipStackPrimitive CoglClipStackPrimitive; + +typedef enum + { + COGL_CLIP_STACK_RECT, + COGL_CLIP_STACK_WINDOW_RECT, + COGL_CLIP_STACK_PATH, + 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_from_path (stack_a, ...); + * CoglClipStack *stack_b = NULL; + * stack_b = cogl_clip_stack_push_window_rectangle (stack_b, ...); + * + * stack_a + * \ holds a ref to + * +-----------+ + * | path 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 +{ + CoglClipStackType type; + + /* 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; + + /* 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; + + /* 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. */ + gboolean can_be_scissor; + + /* The matrix that was current when the clip was set */ + CoglMatrix matrix; +}; + +struct _CoglClipStackWindowRect +{ + CoglClipStack _parent_data; + + /* The window rect clip doesn't need any specific data because it + just adds to the scissor clip */ +}; + +struct _CoglClipStackPath +{ + CoglClipStack _parent_data; + + /* The matrix that was current when the clip was set */ + CoglMatrix matrix; + + CoglPath *path; +}; + +struct _CoglClipStackPrimitive +{ + CoglClipStack _parent_data; + + /* The matrix that was current when the clip was set */ + CoglMatrix matrix; + + 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, + const CoglMatrix *modelview_matrix); + +CoglClipStack * +_cogl_clip_stack_push_from_path (CoglClipStack *stack, + CoglPath *path, + const CoglMatrix *modelview_matrix); + +CoglClipStack * +_cogl_clip_stack_push_primitive (CoglClipStack *stack, + CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2, + const CoglMatrix *modelview_matrix); + +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-clip-state-private.h b/cogl/cogl-clip-state-private.h new file mode 100644 index 0000000..e5e1488 --- /dev/null +++ b/cogl/cogl-clip-state-private.h @@ -0,0 +1,56 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_CLIP_STATE_PRIVATE_H +#define __COGL_CLIP_STATE_PRIVATE_H + +#include "cogl-clip-stack.h" + +typedef struct _CoglClipState CoglClipState; + +struct _CoglClipState +{ + /* Stack of CoglClipStacks */ + GSList *stacks; +}; + +void +_cogl_clip_state_init (CoglClipState *state); + +void +_cogl_clip_state_destroy (CoglClipState *state); + +CoglClipStack * +_cogl_clip_state_get_stack (CoglClipState *clip_state); + +void +_cogl_clip_state_set_stack (CoglClipState *clip_state, + CoglClipStack *clip_stack); + +void +_cogl_clip_state_save_clip_stack (CoglClipState *clip_state); + +void +_cogl_clip_state_restore_clip_stack (CoglClipState *clip_state); + +#endif /* __COGL_CLIP_STATE_PRIVATE_H */ diff --git a/cogl/cogl-clip-state.c b/cogl/cogl-clip-state.c new file mode 100644 index 0000000..ca34d78 --- /dev/null +++ b/cogl/cogl-clip-state.c @@ -0,0 +1,207 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +#include "cogl-clip-stack.h" +#include "cogl-clip-state-private.h" +#include "cogl-context-private.h" +#include "cogl-internal.h" +#include "cogl-framebuffer-private.h" +#include "cogl-journal-private.h" +#include "cogl-util.h" +#include "cogl-matrix-private.h" +#include "cogl-clip-state.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_from_path_preserve (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), + ctx->current_path); +} + +#undef cogl_clip_push_from_path +void +cogl_clip_push_from_path (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl_clip_push_from_path_preserve (); + + cogl_object_unref (ctx->current_path); + ctx->current_path = cogl2_path_new (); +} + +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) +{ + _cogl_framebuffer_save_clip_stack (cogl_get_draw_framebuffer ()); +} + +void +cogl_clip_stack_restore (void) +{ + _cogl_framebuffer_restore_clip_stack (cogl_get_draw_framebuffer ()); +} + +/* 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. + */ +} + +void +_cogl_clip_state_init (CoglClipState *clip_state) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + clip_state->stacks = NULL; + + /* Add an intial stack */ + _cogl_clip_state_save_clip_stack (clip_state); +} + +void +_cogl_clip_state_destroy (CoglClipState *clip_state) +{ + /* Destroy all of the stacks */ + while (clip_state->stacks) + _cogl_clip_state_restore_clip_stack (clip_state); +} + +CoglClipStack * +_cogl_clip_state_get_stack (CoglClipState *clip_state) +{ + return clip_state->stacks->data; +} + +void +_cogl_clip_state_set_stack (CoglClipState *clip_state, + CoglClipStack *stack) +{ + /* Replace the top of the stack of stacks */ + _cogl_clip_stack_ref (stack); + _cogl_clip_stack_unref (clip_state->stacks->data); + clip_state->stacks->data = stack; +} + +void +_cogl_clip_state_save_clip_stack (CoglClipState *clip_state) +{ + clip_state->stacks = g_slist_prepend (clip_state->stacks, NULL); +} + +void +_cogl_clip_state_restore_clip_stack (CoglClipState *clip_state) +{ + CoglHandle stack; + + _COGL_RETURN_IF_FAIL (clip_state->stacks != NULL); + + stack = clip_state->stacks->data; + + _cogl_clip_stack_unref (stack); + + /* Revert to an old stack */ + clip_state->stacks = g_slist_delete_link (clip_state->stacks, + clip_state->stacks); +} diff --git a/cogl/cogl-clip-state.h b/cogl/cogl-clip-state.h new file mode 100644 index 0000000..b51943f --- /dev/null +++ b/cogl/cogl-clip-state.h @@ -0,0 +1,50 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_CLIP_STATE_H +#define __COGL_CLIP_STATE_H + +#include + +G_BEGIN_DECLS + +/** + * 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 + */ +void +cogl_clip_push_from_path (void); + +G_END_DECLS + +#endif /* __COGL_CLIP_STATE_H */ diff --git a/cogl/cogl-clutter-xlib.h b/cogl/cogl-clutter-xlib.h new file mode 100644 index 0000000..766ceba --- /dev/null +++ b/cogl/cogl-clutter-xlib.h @@ -0,0 +1,41 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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(__COGL_XLIB_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_CLUTTER_XLIB_H__ +#define __COGL_CLUTTER_XLIB_H__ + +#include + +G_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); + +G_END_DECLS + +#endif /* __COGL_CLUTTER_XLIB_H__ */ diff --git a/cogl/cogl-clutter.c b/cogl/cogl-clutter.c new file mode 100644 index 0000000..63bcc1b --- /dev/null +++ b/cogl/cogl-clutter.c @@ -0,0 +1,88 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#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" + +gboolean +cogl_clutter_check_extension (const char *name, const char *ext) +{ + return _cogl_check_extension (name, ext); +} + +gboolean +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/cogl-clutter.h b/cogl/cogl-clutter.h new file mode 100644 index 0000000..3125db8 --- /dev/null +++ b/cogl/cogl-clutter.h @@ -0,0 +1,47 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_CLUTTER_H__ +#define __COGL_CLUTTER_H__ + +G_BEGIN_DECLS + +#define cogl_clutter_check_extension cogl_clutter_check_extension_CLUTTER +gboolean +cogl_clutter_check_extension (const char *name, const char *ext); + +#define cogl_clutter_winsys_has_feature cogl_clutter_winsys_has_feature_CLUTTER +gboolean +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); + +G_END_DECLS + +#endif /* __COGL_CLUTTER_H__ */ diff --git a/cogl/cogl-color-private.h b/cogl/cogl-color-private.h new file mode 100644 index 0000000..78bfcf9 --- /dev/null +++ b/cogl/cogl-color-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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, + guint8 *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..9359f44 --- /dev/null +++ b/cogl/cogl-color.c @@ -0,0 +1,314 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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" + +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, + guint8 red, + guint8 green, + guint8 blue, + guint8 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, + guint8 red, + guint8 green, + guint8 blue, + guint8 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, + 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; + } +} + +gboolean +cogl_color_equal (gconstpointer v1, gconstpointer v2) +{ + const guint32 *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, + guint8 *dest) +{ + memcpy (dest, color, 4); +} + diff --git a/cogl/cogl-color.h b/cogl/cogl-color.h new file mode 100644 index 0000000..7ca7cb6 --- /dev/null +++ b/cogl/cogl-color.h @@ -0,0 +1,544 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +/** + * 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 + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_COLOR_H__ +#define __COGL_COLOR_H__ + +#include + +G_BEGIN_DECLS + +/** + * 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, + guint8 red, + guint8 green, + guint8 blue, + guint8 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. + */ +void +cogl_color_set_from_4ub (CoglColor *color, + guint8 red, + guint8 green, + guint8 blue, + guint8 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. + */ +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, + 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 + */ +gboolean +cogl_color_equal (gconstpointer v1, + gconstpointer v2); + +G_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..14b43bb --- /dev/null +++ b/cogl/cogl-config-private.h @@ -0,0 +1,37 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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; + +#endif /* __COGL_CONFIG_PRIVATE_H */ diff --git a/cogl/cogl-config.c b/cogl/cogl-config.c new file mode 100644 index 0000000..4678ce4 --- /dev/null +++ b/cogl/cogl-config.c @@ -0,0 +1,118 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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; + +static void +_cogl_config_process (GKeyFile *key_file) +{ + char *value; + + 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); + } + + value = g_key_file_get_string (key_file, "global", "COGL_DRIVER", NULL); + if (value) + { + if (_cogl_config_driver) + g_free (_cogl_config_driver); + + _cogl_config_driver = value; + } + + value = g_key_file_get_string (key_file, "global", "COGL_RENDERER", NULL); + if (value) + { + if (_cogl_config_renderer) + g_free (_cogl_config_renderer); + + _cogl_config_renderer = 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; + gboolean 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); +} diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h new file mode 100644 index 0000000..6d92faf --- /dev/null +++ b/cogl/cogl-context-private.h @@ -0,0 +1,335 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_CONTEXT_PRIVATE_H +#define __COGL_CONTEXT_PRIVATE_H + +#include "cogl-internal.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-texture-driver.h" +#include "cogl-pipeline-cache.h" +#include "cogl-texture-2d.h" +#include "cogl-texture-3d.h" +#include "cogl-texture-rectangle.h" + +typedef struct +{ + GLfloat v[3]; + GLfloat t[2]; + GLubyte c[4]; +} CoglTextureGLVertex; + +struct _CoglContext +{ + CoglObject _parent; + + CoglDisplay *display; + + CoglDriver driver; + + /* vtable for the texture driver functions */ + const CoglTextureDriver *texture_driver; + + /* Features cache */ + unsigned long features[COGL_FLAGS_N_LONGS_FOR_SIZE (_COGL_N_FEATURE_IDS)]; + CoglFeatureFlags feature_flags; /* legacy/deprecated feature flags */ + CoglPrivateFeatureFlags private_feature_flags; + + 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; + + gboolean 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 that should be used for the next render */ + CoglMatrixStack *current_projection_stack; + CoglMatrixStack *current_modelview_stack; + + /* The last matrix stack with age that was flushed to the GL matrix + builtins */ + CoglMatrixStackCache builtin_flushed_projection; + CoglMatrixStackCache 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; + 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; + gboolean current_pipeline_skip_gl_color; + unsigned long current_pipeline_age; + + gboolean gl_blend_enable_cache; + + gboolean depth_test_enabled_cache; + CoglDepthTestFunction depth_test_function_cache; + gboolean depth_writing_enabled_cache; + float depth_range_near_cache; + float depth_range_far_cache; + + gboolean legacy_depth_test_enabled; + + CoglBuffer *current_buffer[COGL_BUFFER_BIND_TARGET_COUNT]; + + /* Framebuffers */ + GSList *framebuffer_stack; + CoglHandle window_buffer; + unsigned long current_draw_buffer_state_flushed; + unsigned long current_draw_buffer_changes; + CoglFramebuffer *current_draw_buffer; + CoglFramebuffer *current_read_buffer; + + /* Primitives */ + CoglPath *current_path; + CoglPipeline *stencil_pipeline; + + /* Pre-generated VBOs containing indices to generate GL_TRIANGLES + out of a vertex array of quads */ + CoglHandle quad_buffer_indices_byte; + unsigned int quad_buffer_indices_len; + CoglHandle quad_buffer_indices; + + CoglIndices *rectangle_byte_indices; + CoglIndices *rectangle_short_indices; + int rectangle_short_indices_len; + + gboolean 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 */ + guint8 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; + + gboolean current_gl_dither_enabled; + CoglColorMask current_gl_color_mask; + + /* List of types that will be considered a subclass of CoglTexture in + cogl_is_texture */ + GSList *texture_types; + + /* List of types that will be considered a subclass of CoglBuffer in + cogl_is_buffer */ + GSList *buffer_types; + + /* 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) */ + gboolean 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 */ + gboolean 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; + gboolean buffer_map_fallback_in_use; + + CoglWinsysRectangleState rectangle_state; + + /* 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; + + /* 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 */ +gboolean +_cogl_context_update_features (CoglContext *context, + GError **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 (CoglContext *context, + CoglMatrixStack *stack); + +void +_cogl_context_set_current_modelview (CoglContext *context, + CoglMatrixStack *stack); + +#endif /* __COGL_CONTEXT_PRIVATE_H */ diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c new file mode 100644 index 0000000..c68ff41 --- /dev/null +++ b/cogl/cogl-context.c @@ -0,0 +1,620 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-object.h" +#include "cogl-internal.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-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 "cogl2-path.h" +#include "cogl-attribute-private.h" +#include "cogl1-context.h" + +#include + +#ifdef HAVE_COGL_GL +#include "cogl-pipeline-fragend-arbfp-private.h" +#endif + +/* This isn't defined in the GLES headers */ +#ifndef GL_POINT_SPRITE +#define GL_POINT_SPRITE 0x8861 +#endif + +#ifdef HAVE_COGL_GL +extern const CoglTextureDriver _cogl_texture_driver_gl; +#endif +#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2) +extern const CoglTextureDriver _cogl_texture_driver_gles; +#endif + +static void _cogl_context_free (CoglContext *context); + +COGL_OBJECT_DEFINE (Context, context); + +extern void +_cogl_create_context_driver (CoglContext *context); + +static CoglContext *_context = NULL; + +static void +_cogl_init_feature_overrides (CoglContext *ctx) +{ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS))) + ctx->private_feature_flags &= ~COGL_PRIVATE_FEATURE_VBOS; + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS))) + ctx->private_feature_flags &= ~COGL_PRIVATE_FEATURE_PBOS; + + 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); + } + + 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, + GError **error) +{ + CoglContext *context; + GLubyte default_texture_data[] = { 0xff, 0xff, 0xff, 0x0 }; + CoglBitmap *default_texture_bitmap; + const CoglWinsysVtable *winsys; + int i; + + _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_malloc (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. + */ + _context = context; + + /* Init default values */ + memset (context->features, 0, sizeof (context->features)); + context->feature_flags = 0; + context->private_feature_flags = 0; + + context->texture_types = NULL; + context->buffer_types = NULL; + + 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); + } + 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; + + winsys = _cogl_context_get_winsys (context); + if (!winsys->context_init (context, error)) + { + cogl_object_unref (display); + g_free (context); + return NULL; + } + + switch (context->driver) + { +#ifdef HAVE_COGL_GL + case COGL_DRIVER_GL: + context->texture_driver = &_cogl_texture_driver_gl; + break; +#endif + +#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2) + case COGL_DRIVER_GLES1: + case COGL_DRIVER_GLES2: + context->texture_driver = &_cogl_texture_driver_gles; + break; +#endif + + default: + g_assert_not_reached (); + } + + 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); + + _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)); + + /* 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->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->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_skip_gl_color = 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_program = COGL_INVALID_HANDLE; + + 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 = cogl2_path_new (); + context->stencil_pipeline = cogl_pipeline_new (context); + + context->in_begin_gl_block = FALSE; + + context->quad_buffer_indices_byte = COGL_INVALID_HANDLE; + context->quad_buffer_indices = COGL_INVALID_HANDLE; + 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 = COGL_INVALID_HANDLE; + context->blit_texture_pipeline = COGL_INVALID_HANDLE; + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + if (context->driver != COGL_DRIVER_GLES2) + /* 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 + + _context->current_modelview_stack = NULL; + _context->current_projection_stack = NULL; + _cogl_matrix_stack_init_cache (&_context->builtin_flushed_projection); + _cogl_matrix_stack_init_cache (&_context->builtin_flushed_modelview); + + default_texture_bitmap = + cogl_bitmap_new_for_data (_context, + 1, 1, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + default_texture_data); + + /* Create default textures used for fall backs */ + context->default_gl_texture_2d_tex = + _cogl_texture_2d_new_from_bitmap (default_texture_bitmap, + COGL_TEXTURE_NONE, + /* internal format */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + NULL); + /* If 3D or rectangle textures aren't supported then these should + just silently return NULL */ + context->default_gl_texture_3d_tex = + _cogl_texture_3d_new_from_bitmap (context, + default_texture_bitmap, + 1, /* height */ + 1, /* depth */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + NULL); + context->default_gl_texture_rect_tex = + _cogl_texture_rectangle_new_from_bitmap (default_texture_bitmap, + COGL_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE); + + cogl_object_unref (default_texture_bitmap); + + cogl_push_source (context->opaque_color_pipeline); + _cogl_pipeline_flush_gl_state (context->opaque_color_pipeline, FALSE, 0); + + 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 GLES2 because point + sprites are handled using a builtin varying in the shader. */ + if (_context->driver != COGL_DRIVER_GLES2 && + cogl_has_feature (context, COGL_FEATURE_ID_POINT_SPRITE)) + GE (context, glEnable (GL_POINT_SPRITE)); + + 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_handle_unref (context->opaque_color_pipeline); + if (context->blended_color_pipeline) + cogl_handle_unref (context->blended_color_pipeline); + if (context->texture_pipeline) + cogl_handle_unref (context->texture_pipeline); + + if (context->blit_texture_pipeline) + cogl_handle_unref (context->blit_texture_pipeline); + + 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_handle_unref (context->quad_buffer_indices_byte); + if (context->quad_buffer_indices) + cogl_handle_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_handle_unref (context->default_pipeline); + + if (context->dummy_layer_dependant) + cogl_handle_unref (context->dummy_layer_dependant); + if (context->default_layer_n) + cogl_handle_unref (context->default_layer_n); + if (context->default_layer_0) + cogl_handle_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); + + g_slist_free (context->texture_types); + g_slist_free (context->buffer_types); + + if (_context->current_modelview_stack) + cogl_object_unref (_context->current_modelview_stack); + if (_context->current_projection_stack) + cogl_object_unref (_context->current_projection_stack); + _cogl_matrix_stack_destroy_cache (&context->builtin_flushed_projection); + _cogl_matrix_stack_destroy_cache (&context->builtin_flushed_modelview); + + cogl_pipeline_cache_free (context->pipeline_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) +{ + GError *error = NULL; + /* Create if doesn't exist yet */ + if (_context == NULL) + { + _context = cogl_context_new (NULL, &error); + if (!_context) + { + g_warning ("Failed to create default context: %s", + error->message); + g_error_free (error); + } + } + + return _context; +} + +CoglDisplay * +cogl_context_get_display (CoglContext *context) +{ + return context->display; +} + +#ifdef COGL_HAS_EGL_SUPPORT +EGLDisplay +cogl_egl_context_get_egl_display (CoglContext *context) +{ + const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); + + /* This should only be called for EGL contexts */ + _COGL_RETURN_VAL_IF_FAIL (winsys->context_egl_get_egl_display != NULL, NULL); + + return winsys->context_egl_get_egl_display (context); +} +#endif + +gboolean +_cogl_context_update_features (CoglContext *context, + GError **error) +{ +#ifdef HAVE_COGL_GL + if (context->driver == COGL_DRIVER_GL) + return _cogl_gl_update_features (context, error); +#endif + +#if defined(HAVE_COGL_GLES) || defined(HAVE_COGL_GLES2) + return _cogl_gles_update_features (context, error); +#endif + + g_assert_not_reached (); +} + +void +_cogl_context_set_current_projection (CoglContext *context, + CoglMatrixStack *stack) +{ + cogl_object_ref (stack); + if (context->current_projection_stack) + cogl_object_unref (context->current_projection_stack); + context->current_projection_stack = stack; +} + +void +_cogl_context_set_current_modelview (CoglContext *context, + CoglMatrixStack *stack) +{ + cogl_object_ref (stack); + if (context->current_modelview_stack) + cogl_object_unref (context->current_modelview_stack); + context->current_modelview_stack = stack; +} diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h new file mode 100644 index 0000000..e2120d7 --- /dev/null +++ b/cogl/cogl-context.h @@ -0,0 +1,317 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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_EGL_PLATFORM_ANDROID_SUPPORT +#include +#endif + +G_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. + */ + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +#define COGL_CONTEXT(OBJECT) ((CoglContext *)OBJECT) + +/** + * cogl_context_new: + * @display: A #CoglDisplay pointer + * @error: A GError 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, + GError **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); + +#ifdef COGL_HAS_EGL_SUPPORT +/** + * 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. + * + * Return value: The internally setup EGLDisplay handle. + * Since: 1.8 + * Stability: unstable + */ +EGLDisplay +cogl_egl_context_get_egl_display (CoglContext *context); +#endif + +#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 handle references a #CoglContext, + * %FALSE otherwise + * + * Since: 1.10 + * Stability: Unstable + */ +gboolean +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_RENDERER_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_RENDERER_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_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_RENDERER_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. + * + * 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, + + /*< private > */ + _COGL_N_FEATURE_IDS +} 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 + */ +gboolean +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 + */ +gboolean +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: A #CoglFeatureCallback called for each supported feature + * @user_data: 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); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +G_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..c5d486d --- /dev/null +++ b/cogl/cogl-debug-options.h @@ -0,0 +1,187 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + */ + +OPT (HANDLE, + 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")) diff --git a/cogl/cogl-debug.c b/cogl/cogl-debug.c new file mode 100644 index 0000000..d838cae --- /dev/null +++ b/cogl/cogl-debug.c @@ -0,0 +1,286 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#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[] = { + { "handle", COGL_DEBUG_HANDLE }, + { "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 } +}; +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, + gboolean 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 a guint but the flags is stored in an array of multiple + longs so we need to build a separate array for each possible + guint */ + + 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, + gboolean enable, + gboolean 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 + 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 gboolean +cogl_arg_debug_cb (const char *key, + const char *value, + gpointer user_data) +{ + _cogl_parse_debug_string (value, + TRUE /* enable the flags */, + FALSE /* don't ignore help */); + return TRUE; +} + +static gboolean +cogl_arg_no_debug_cb (const char *key, + const char *value, + gpointer 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 gboolean +pre_parse_hook (GOptionContext *context, + GOptionGroup *group, + gpointer 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..83534c8 --- /dev/null +++ b/cogl/cogl-debug.h @@ -0,0 +1,135 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_DEBUG_H__ +#define __COGL_DEBUG_H__ + +#include "cogl-profile.h" +#include "cogl-flags.h" +#include "cogl-util.h" + +#include + +G_BEGIN_DECLS + +typedef enum { + COGL_DEBUG_SLICING, + COGL_DEBUG_OFFSCREEN, + COGL_DEBUG_DRAW, + COGL_DEBUG_PANGO, + COGL_DEBUG_RECTANGLES, + COGL_DEBUG_HANDLE, + 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_N_FLAGS +} CoglDebugFlags; + +#ifdef COGL_ENABLE_DEBUG + +#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]; + +extern GHashTable *_cogl_debug_instances; + +#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__ */ + +#else /* !COGL_ENABLE_DEBUG */ + +#define COGL_NOTE(type,...) G_STMT_START {} G_STMT_END + +#define COGL_DEBUG_ENABLED(flag) FALSE + +#define COGL_DEBUG_SET_FLAG(flag) \ + G_STMT_START { } G_STMT_END + +#define COGL_DEBUG_CLEAR_FLAG(flag) \ + G_STMT_START { } G_STMT_END + +#endif /* COGL_ENABLE_DEBUG */ + +void +_cogl_debug_check_environment (void); + +void +_cogl_parse_debug_string (const char *value, + gboolean enable, + gboolean ignore_help); + +G_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..3d4b17d --- /dev/null +++ b/cogl/cogl-defines.h.in @@ -0,0 +1,49 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +#include +@COGL_GL_HEADER_INCLUDES@ + +G_BEGIN_DECLS + +@COGL_DEFINES@ + +#ifdef COGL_HAS_EGL_SUPPORT +@COGL_EGL_INCLUDES@ +#define NativeDisplayType EGLNativeDisplayType +#define NativeWindowType EGLNativeWindowType +#endif + +#ifndef GL_OES_EGL_image +#define GLeglImageOES void * +#endif +G_END_DECLS + +#endif diff --git a/cogl/cogl-defines.h.win32 b/cogl/cogl-defines.h.win32 new file mode 100644 index 0000000..75a70ba --- /dev/null +++ b/cogl/cogl-defines.h.win32 @@ -0,0 +1,68 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +#include +#include +#include +#include + +G_BEGIN_DECLS + +#define COGL_HAS_GLIB_SUPPORT 1 +#define COGL_HAS_WGL_SUPPORT 1 +#define COGL_HAS_WIN32_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 +#define NativeDisplayType EGLNativeDisplayType +#define NativeWindowType EGLNativeWindowType +#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 + +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..5141857 --- /dev/null +++ b/cogl/cogl-defines.h.win32_SDL @@ -0,0 +1,69 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEFINES_H__ +#define __COGL_DEFINES_H__ + +#include +#include +#include +#include + +G_BEGIN_DECLS + +#define COGL_HAS_GLIB_SUPPORT 1 +#define COGL_HAS_WGL_SUPPORT 1 +#define COGL_HAS_WIN32_SUPPORT 1 +#define COGL_HAS_SDL_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 +#define NativeDisplayType EGLNativeDisplayType +#define NativeWindowType EGLNativeWindowType +#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 + +G_END_DECLS + +#endif diff --git a/cogl/cogl-deprecated.h b/cogl/cogl-deprecated.h new file mode 100644 index 0000000..aee5b1c --- /dev/null +++ b/cogl/cogl-deprecated.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..362f08f --- /dev/null +++ b/cogl/cogl-depth-state-private.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * 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..2e5c86f --- /dev/null +++ b/cogl/cogl-depth-state.c @@ -0,0 +1,110 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * 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, + gboolean enabled) +{ + _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC); + state->test_enabled = enabled; +} + +gboolean +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, + gboolean enabled) +{ + _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC); + state->write_enabled = enabled; +} + +gboolean +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..0fff9a0 --- /dev/null +++ b/cogl/cogl-depth-state.h @@ -0,0 +1,260 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DEPTH_STATE_H__ +#define __COGL_DEPTH_STATE_H__ + +G_BEGIN_DECLS + +/** + * SECTION:cogl-depth-state + * @short_description: Functions for describing the depth testing + * state of your GPU. + */ + +typedef struct +{ + guint32 COGL_PRIVATE (magic); + + gboolean COGL_PRIVATE (test_enabled); + CoglDepthTestFunction COGL_PRIVATE (test_function); + gboolean COGL_PRIVATE (write_enabled); + float COGL_PRIVATE (range_near); + float COGL_PRIVATE (range_far); + + guint32 COGL_PRIVATE (padding0); + guint32 COGL_PRIVATE (padding1); + guint32 COGL_PRIVATE (padding2); + guint32 COGL_PRIVATE (padding3); + guint32 COGL_PRIVATE (padding4); + guint32 COGL_PRIVATE (padding5); + guint32 COGL_PRIVATE (padding6); + guint32 COGL_PRIVATE (padding7); + guint32 COGL_PRIVATE (padding8); + guint32 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_pipeline_set_depth_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_pipeline_set_depth_writing_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, + gboolean 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 + */ +gboolean +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, + gboolean enable); + +/** + * cogl_depth_state_get_write_enabled: + * @state: A #CoglDepthState struct + * + * Gets the depth writing enable state as set by the corresponding + * cogl_pipeline_set_depth_writing_enabled. + * + * Returns: The current depth writing enable state + * Since: 2.0 + * Stability: Unstable + */ +gboolean +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_pipeline_set_depth_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_pipeline_set_depth_range(). + * + * Since: 2.0 + * Stability: Unstable + */ +void +cogl_depth_state_get_range (CoglDepthState *state, + float *near_val, + float *far_val); + +G_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..179aa41 --- /dev/null +++ b/cogl/cogl-display-private.h @@ -0,0 +1,56 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + */ + +#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" +#include "cogl-internal.h" +#if COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +#include +#endif + +struct _CoglDisplay +{ + CoglObject _parent; + + gboolean 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..9ac1b68 --- /dev/null +++ b/cogl/cogl-display.c @@ -0,0 +1,155 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-private.h" +#include "cogl-object.h" +#include "cogl-internal.h" + +#include "cogl-display-private.h" +#include "cogl-renderer-private.h" +#include "cogl-winsys-private.h" + +static void _cogl_display_free (CoglDisplay *display); + +COGL_OBJECT_DEFINE (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); + GError *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->onscreen_template = onscreen_template; + if (onscreen_template) + cogl_object_ref (onscreen_template); + else + display->onscreen_template = cogl_onscreen_template_new (NULL); + + display->setup = FALSE; + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT + display->gdl_plane = GDL_PLANE_ID_UPP_C; +#endif + + return _cogl_display_object_new (display); +} + +CoglRenderer * +cogl_display_get_renderer (CoglDisplay *display) +{ + return display->renderer; +} + +gboolean +cogl_display_setup (CoglDisplay *display, + GError **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..d4d4735 --- /dev/null +++ b/cogl/cogl-display.h @@ -0,0 +1,209 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_DISPLAY_H__ +#define __COGL_DISPLAY_H__ + +#include +#include + +G_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) + +/** + * 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. + * + * 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 arguements. + * + * 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: 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. + * + * Since: 1.10 + * Stability: unstable + */ +CoglRenderer * +cogl_display_get_renderer (CoglDisplay *display); + +/** + * cogl_display_setup: + * @display: a #CoglDisplay + * @error: return location for a #GError + * + * 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 arguements. + * + * 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 + */ +gboolean +cogl_display_setup (CoglDisplay *display, + GError **error); + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT +/** + * cogl_gdl_display_set_plane: + * @display: a #CoglDisplay + * + * 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 + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +/** + * 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); +#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 + */ +gboolean +cogl_is_display (void *object); + +G_END_DECLS + +#endif /* __COGL_DISPLAY_H__ */ + diff --git a/cogl/cogl-enum-types.c.in b/cogl/cogl-enum-types.c.in new file mode 100644 index 0000000..4ca1d75 --- /dev/null +++ b/cogl/cogl-enum-types.c.in @@ -0,0 +1,40 @@ +/*** BEGIN file-header ***/ +#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..23d705d --- /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 /* !__CLUTTER_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-euler.c b/cogl/cogl-euler.c new file mode 100644 index 0000000..3ebd264 --- /dev/null +++ b/cogl/cogl-euler.c @@ -0,0 +1,188 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include +#include + +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; +} + +gboolean +cogl_euler_equal (gconstpointer v1, gconstpointer 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..e82eab1 --- /dev/null +++ b/cogl/cogl-euler.h @@ -0,0 +1,253 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_EULER_H +#define __COGL_EULER_H + +#include + +#include + +G_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); + +/** + * 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 + * @v1: 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 + */ +gboolean +cogl_euler_equal (gconstpointer v1, gconstpointer 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); + +G_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..9714e8d --- /dev/null +++ b/cogl/cogl-feature-private.c @@ -0,0 +1,197 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-context-private.h" + +#include "cogl-feature-private.h" +#include "cogl-renderer-private.h" + +gboolean +_cogl_feature_check (CoglRenderer *renderer, + const char *driver_prefix, + const CoglFeatureData *data, + int gl_major, + int gl_minor, + CoglDriver driver, + const char *extensions_string, + void *function_table) + +{ + const char *suffix = NULL; + int func_num; + + /* First check whether the functions should be directly provided by + GL */ + if ((driver == COGL_DRIVER_GL && + COGL_CHECK_GL_VERSION (gl_major, gl_minor, + data->min_gl_major, data->min_gl_minor)) || + (driver == COGL_DRIVER_GLES1 && + (data->gles_availability & COGL_EXT_IN_GLES)) || + (driver == COGL_DRIVER_GLES2 && + (data->gles_availability & COGL_EXT_IN_GLES2))) + suffix = ""; + 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_string)) + 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; + } + } + } + + /* 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); + g_free (full_function_name); + + if (func == NULL) + goto error; + + /* Set the function pointer in the context */ + *(void **) ((guint8 *) 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 **) ((guint8 *) 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, + const char *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..c2cec7c --- /dev/null +++ b/cogl/cogl-feature-private.h @@ -0,0 +1,99 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_FEATURE_PRIVATE_H +#define __COGL_FEATURE_PRIVATE_H + +#include + +#include "cogl-internal.h" + +#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) +} 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; +}; + +gboolean +_cogl_feature_check (CoglRenderer *renderer, + const char *driver_prefix, + const CoglFeatureData *data, + int gl_major, + int gl_minor, + CoglDriver driver, + const char *extensions_string, + void *function_table); + +void +_cogl_feature_check_ext_functions (CoglContext *context, + int gl_major, + int gl_minor, + const char *gl_extensions); + +#endif /* __COGL_FEATURE_PRIVATE_H */ diff --git a/cogl/cogl-fixed.c b/cogl/cogl-fixed.c new file mode 100644 index 0000000..7a00cb6 --- /dev/null +++ b/cogl/cogl-fixed.c @@ -0,0 +1,1097 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#define G_IMPLEMENT_INLINES + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#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 guint16 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 + */ +#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 + +/* + * 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) +{ + gboolean 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__) + /* 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; + guint32 y_1; /* 10.22 fixed point */ + guint32 f = 0x600000; /* '1.5' as 10.22 fixed */ + + union + { + float f; + guint32 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) +{ +#ifdef __arm__ + /* 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 + gint64 r = (gint64) a * (gint64) b; + + return (CoglFixed) (r >> COGL_FIXED_Q); +#endif +} + +CoglFixed +cogl_fixed_div (CoglFixed a, + CoglFixed b) +{ + return (CoglFixed) ((((gint64) 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; + guint32 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) +{ + gint32 *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/cogl-fixed.h b/cogl/cogl-fixed.h new file mode 100644 index 0000000..5d7e567 --- /dev/null +++ b/cogl/cogl-fixed.h @@ -0,0 +1,804 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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. + */ + +G_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) ((((gint64) 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); + +G_END_DECLS + +#endif /* __COGL_FIXED_H__ */ diff --git a/cogl/cogl-flags.h b/cogl/cogl-flags.h new file mode 100644 index 0000000..d62294a --- /dev/null +++ b/cogl/cogl-flags.h @@ -0,0 +1,125 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_FLAGS_H +#define __COGL_FLAGS_H + +#include + +#include "cogl-util.h" + +G_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 + +G_END_DECLS + +#endif /* __COGL_FLAGS_H */ + diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h new file mode 100644 index 0000000..0081a2f --- /dev/null +++ b/cogl/cogl-framebuffer-private.h @@ -0,0 +1,392 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_FRAMEBUFFER_PRIVATE_H +#define __COGL_FRAMEBUFFER_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-matrix-stack.h" +#include "cogl-clip-state-private.h" +#include "cogl-journal-private.h" +#include "cogl-winsys-private.h" +#include "cogl-attribute-private.h" +#include "cogl-offscreen.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; + gboolean need_stencil; + int samples_per_pixel; + gboolean swap_throttled; +} CoglFramebufferConfig; + +/* Flags to pass to _cogl_offscreen_new_to_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_MAX = 8 +} 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 +} 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, + CoglPixelFormat format, + int width, + int height); + +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_dirty (CoglFramebuffer *framebuffer); + +CoglClipState * +_cogl_framebuffer_get_clip_state (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_to_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_to_texture_full (CoglTexture *texture, + CoglOffscreenFlags create_flags, + unsigned 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_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 (unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned 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); + +void +_cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPrimitive *primitive, + CoglDrawFlags flags); + +/* 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); + +#endif /* __COGL_FRAMEBUFFER_PRIVATE_H */ diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c new file mode 100644 index 0000000..e9bde6a --- /dev/null +++ b/cogl/cogl-framebuffer.c @@ -0,0 +1,3398 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-debug.h" +#include "cogl-internal.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" + +#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_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 + + +typedef enum { + _TRY_DEPTH_STENCIL = 1L<<0, + _TRY_DEPTH24_STENCIL8 = 1L<<1, + _TRY_DEPTH = 1L<<2, + _TRY_STENCIL = 1L<<3 +} TryFBOFlags; + +typedef struct _CoglFramebufferStackEntry +{ + CoglFramebuffer *draw_buffer; + CoglFramebuffer *read_buffer; +} CoglFramebufferStackEntry; + +extern CoglObjectClass _cogl_onscreen_class; + +static CoglUserDataKey wire_pipeline_key; + +static void _cogl_offscreen_free (CoglOffscreen *offscreen); + +COGL_OBJECT_DEFINE_WITH_CODE (Offscreen, offscreen, + _cogl_offscreen_class.virt_unref = + _cogl_framebuffer_unref); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (offscreen); + +/* 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. + */ + +GQuark +cogl_framebuffer_error_quark (void) +{ + return g_quark_from_static_string ("cogl-framebuffer-error-quark"); +} + +gboolean +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, + CoglPixelFormat format, + int width, + int height) +{ + framebuffer->context = cogl_object_ref (ctx); + + framebuffer->type = type; + framebuffer->width = width; + framebuffer->height = height; + framebuffer->format = format; + framebuffer->viewport_x = 0; + framebuffer->viewport_y = 0; + framebuffer->viewport_width = width; + framebuffer->viewport_height = height; + framebuffer->dither_enabled = TRUE; + + framebuffer->modelview_stack = _cogl_matrix_stack_new (); + framebuffer->projection_stack = _cogl_matrix_stack_new (); + + framebuffer->dirty_bitmasks = TRUE; + + framebuffer->color_mask = COGL_COLOR_MASK_ALL; + + framebuffer->samples_per_pixel = 0; + + /* Initialise the clip stack */ + _cogl_clip_state_init (&framebuffer->clip_state); + + 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_free (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + _cogl_clip_state_destroy (&framebuffer->clip_state); + + 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); + + ctx->framebuffers = g_list_remove (ctx->framebuffers, framebuffer); + cogl_object_unref (ctx); + + 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) +{ + GLbitfield gl_buffers = 0; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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 (buffers & COGL_BUFFER_BIT_STENCIL) + gl_buffers |= GL_STENCIL_BUFFER_BIT; + + if (!gl_buffers) + { + static gboolean shown = FALSE; + + if (!shown) + { + g_warning ("You should specify at least one auxiliary buffer " + "when calling cogl_clear"); + } + + return; + } + + GE (ctx, glClear (gl_buffers)); +} + +void +_cogl_framebuffer_dirty (CoglFramebuffer *framebuffer) +{ + framebuffer->clear_clip_dirty = TRUE; +} + +void +cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer, + unsigned long buffers, + float red, + float green, + float blue, + float alpha) +{ + CoglClipStack *clip_stack = _cogl_framebuffer_get_clip_stack (framebuffer); + int scissor_x0; + int scissor_y0; + int scissor_x1; + int scissor_y1; + + _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); + + /* 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); + + /* 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: + + 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 */ + } + } + else + _cogl_framebuffer_dirty (framebuffer); +} + +/* 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)); +} + +int +cogl_framebuffer_get_width (CoglFramebuffer *framebuffer) +{ + return framebuffer->width; +} + +int +cogl_framebuffer_get_height (CoglFramebuffer *framebuffer) +{ + return framebuffer->height; +} + +CoglClipState * +_cogl_framebuffer_get_clip_state (CoglFramebuffer *framebuffer) +{ + return &framebuffer->clip_state; +} + +CoglClipStack * +_cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + + return _cogl_clip_state_get_stack (clip_state); +} + +void +_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer, + CoglClipStack *stack) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + + _cogl_clip_state_set_stack (clip_state, stack); +} + +void +cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer, + float x, + float y, + float width, + float height) +{ + _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; + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_VIEWPORT; +} + +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) +{ + return framebuffer->viewport_width; +} + +float +cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer) +{ + return framebuffer->viewport_height; +} + +void +cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer, + float *viewport) +{ + 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); +} + +static inline void +_cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer) +{ + CoglContext *ctx = framebuffer->context; + + cogl_framebuffer_allocate (framebuffer, NULL); + + if (G_LIKELY (!framebuffer->dirty_bitmasks)) + return; + +#ifdef HAVE_COGL_GL + if (ctx->driver == COGL_DRIVER_GL && + cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN) && + framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN) + { + GLenum attachment, pname; + + attachment = GL_COLOR_ATTACHMENT0; + + pname = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE; + GE( ctx, glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, + attachment, + pname, + &framebuffer->red_bits) ); + + pname = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE; + GE( ctx, glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, + attachment, + pname, + &framebuffer->green_bits) + ); + + pname = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE; + GE( ctx, glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, + attachment, + pname, + &framebuffer->blue_bits) + ); + + pname = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE; + GE( ctx, glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER, + attachment, + pname, + &framebuffer->alpha_bits) + ); + } + else +#endif /* HAVE_COGL_GL */ + { + GE( ctx, glGetIntegerv (GL_RED_BITS, &framebuffer->red_bits) ); + GE( ctx, glGetIntegerv (GL_GREEN_BITS, &framebuffer->green_bits) ); + GE( ctx, glGetIntegerv (GL_BLUE_BITS, &framebuffer->blue_bits) ); + GE( ctx, glGetIntegerv (GL_ALPHA_BITS, &framebuffer->alpha_bits) ); + } + + + COGL_NOTE (OFFSCREEN, + "RGBA Bits for framebuffer[%p, %s]: %d, %d, %d, %d", + framebuffer, + framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN + ? "offscreen" + : "onscreen", + framebuffer->red_bits, + framebuffer->blue_bits, + framebuffer->green_bits, + framebuffer->alpha_bits); + + framebuffer->dirty_bitmasks = FALSE; +} + +CoglOffscreen * +_cogl_offscreen_new_to_texture_full (CoglTexture *texture, + CoglOffscreenFlags create_flags, + unsigned int level) +{ + CoglOffscreen *offscreen; + CoglFramebuffer *fb; + int level_width; + int level_height; + int i; + CoglHandle ret; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) + return COGL_INVALID_HANDLE; + + /* Make texture is a valid texture object */ + if (!cogl_is_texture (texture)) + return COGL_INVALID_HANDLE; + + /* The texture must not be sliced */ + if (cogl_texture_is_sliced (texture)) + return COGL_INVALID_HANDLE; + + /* Calculate the size of the texture at this mipmap level to ensure + that it's a valid level */ + level_width = cogl_texture_get_width (texture); + level_height = cogl_texture_get_height (texture); + + for (i = 0; i < level; i++) + { + /* If neither dimension can be further divided then the level is + invalid */ + if (level_width == 1 && level_height == 1) + { + g_warning ("Invalid texture level passed to " + "_cogl_offscreen_new_to_texture_full"); + return COGL_INVALID_HANDLE; + } + + if (level_width > 1) + level_width >>= 1; + if (level_height > 1) + level_height >>= 1; + } + + offscreen = g_new0 (CoglOffscreen, 1); + offscreen->texture = cogl_object_ref (texture); + offscreen->texture_level = level; + offscreen->texture_level_width = level_width; + offscreen->texture_level_height = level_height; + offscreen->create_flags = create_flags; + + fb = COGL_FRAMEBUFFER (offscreen); + + _cogl_framebuffer_init (fb, + ctx, + COGL_FRAMEBUFFER_TYPE_OFFSCREEN, + cogl_texture_get_format (texture), + level_width, + level_height); + + ret = _cogl_offscreen_object_new (offscreen); + + _cogl_texture_associate_framebuffer (texture, fb); + + return ret; +} + +CoglOffscreen * +cogl_offscreen_new_to_texture (CoglTexture *texture) +{ + return _cogl_offscreen_new_to_texture_full (texture, 0, 0); +} + +static void +_cogl_offscreen_free (CoglOffscreen *offscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen); + CoglContext *ctx = framebuffer->context; + GSList *l; + + /* Chain up to parent */ + _cogl_framebuffer_free (framebuffer); + + for (l = offscreen->renderbuffers; l; l = l->next) + { + GLuint renderbuffer = GPOINTER_TO_UINT (l->data); + GE (ctx, glDeleteRenderbuffers (1, &renderbuffer)); + } + g_slist_free (offscreen->renderbuffers); + + GE (ctx, glDeleteFramebuffers (1, &offscreen->fbo_handle)); + + if (offscreen->texture != COGL_INVALID_HANDLE) + cogl_object_unref (offscreen->texture); + + g_free (offscreen); +} + +static gboolean +try_creating_fbo (CoglOffscreen *offscreen, + TryFBOFlags flags) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (offscreen); + CoglContext *ctx = fb->context; + GLuint gl_depth_stencil_handle; + GLuint gl_depth_handle; + GLuint gl_stencil_handle; + GLuint tex_gl_handle; + GLenum tex_gl_target; + GLuint fbo_gl_handle; + GLenum status; + int n_samples; + int height; + int width; + + if (!cogl_texture_get_gl_texture (offscreen->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 (fb->config.samples_per_pixel) + { + if (!ctx->glFramebufferTexture2DMultisampleIMG) + return FALSE; + n_samples = fb->config.samples_per_pixel; + } + else + n_samples = 0; + + width = offscreen->texture_level_width; + height = offscreen->texture_level_height; + + /* 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, &fbo_gl_handle); + GE (ctx, glBindFramebuffer (GL_FRAMEBUFFER, fbo_gl_handle)); + offscreen->fbo_handle = fbo_gl_handle; + + if (n_samples) + { + GE (ctx, glFramebufferTexture2DMultisampleIMG (GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + tex_gl_target, tex_gl_handle, + n_samples, + offscreen->texture_level)); + } + else + GE (ctx, glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + tex_gl_target, tex_gl_handle, + offscreen->texture_level)); + + if (flags & (_TRY_DEPTH_STENCIL | _TRY_DEPTH24_STENCIL8)) + { + GLenum format = ((flags & _TRY_DEPTH_STENCIL) ? + GL_DEPTH_STENCIL : GL_DEPTH24_STENCIL8); + + /* 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)); + 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)); + offscreen->renderbuffers = + g_slist_prepend (offscreen->renderbuffers, + GUINT_TO_POINTER (gl_depth_stencil_handle)); + } + + if (flags & _TRY_DEPTH) + { + 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)); + offscreen->renderbuffers = + g_slist_prepend (offscreen->renderbuffers, + GUINT_TO_POINTER (gl_depth_handle)); + } + + if (flags & _TRY_STENCIL) + { + 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)); + offscreen->renderbuffers = + g_slist_prepend (offscreen->renderbuffers, + GUINT_TO_POINTER (gl_stencil_handle)); + } + + /* Make sure it's complete */ + status = ctx->glCheckFramebufferStatus (GL_FRAMEBUFFER); + + if (status != GL_FRAMEBUFFER_COMPLETE) + { + GSList *l; + + GE (ctx, glDeleteFramebuffers (1, &fbo_gl_handle)); + + for (l = offscreen->renderbuffers; l; l = l->next) + { + GLuint renderbuffer = GPOINTER_TO_UINT (l->data); + GE (ctx, glDeleteRenderbuffers (1, &renderbuffer)); + } + + g_slist_free (offscreen->renderbuffers); + offscreen->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) ); + fb->samples_per_pixel = texture_samples; + } + + return TRUE; +} + +static gboolean +_cogl_offscreen_allocate (CoglOffscreen *offscreen, + GError **error) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (offscreen); + CoglContext *ctx = fb->context; + static TryFBOFlags flags; + static gboolean have_working_flags = FALSE; + gboolean fbo_created; + + /* 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_set_filters (offscreen->texture, GL_NEAREST, GL_NEAREST); + + if ((offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL)) + fbo_created = try_creating_fbo (offscreen, 0); + else + { + if ((have_working_flags && + try_creating_fbo (offscreen, flags)) || + ((ctx->private_feature_flags & + COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL) && + try_creating_fbo (offscreen, flags = _TRY_DEPTH_STENCIL)) || + ((ctx->private_feature_flags & + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL) && + try_creating_fbo (offscreen, flags = _TRY_DEPTH24_STENCIL8)) || + try_creating_fbo (offscreen, flags = _TRY_DEPTH | _TRY_STENCIL) || + try_creating_fbo (offscreen, flags = _TRY_STENCIL) || + try_creating_fbo (offscreen, flags = _TRY_DEPTH) || + try_creating_fbo (offscreen, flags = 0)) + { + /* Record that the last set of flags succeeded so that we can + try that set first next time */ + have_working_flags = TRUE; + fbo_created = TRUE; + } + else + fbo_created = FALSE; + } + + if (!fbo_created) + { + g_set_error (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Failed to create an OpenGL framebuffer object"); + return FALSE; + } + + return TRUE; +} + +gboolean +cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, + GError **error) +{ + CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); + const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); + + if (framebuffer->allocated) + return TRUE; + + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) + { + if (!winsys->onscreen_init (onscreen, error)) + return FALSE; + } + else + { + if (!_cogl_offscreen_allocate (COGL_OFFSCREEN (framebuffer), error)) + return FALSE; + } + + framebuffer->allocated = TRUE; + + return TRUE; +} + +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 (COGL_INVALID_HANDLE, COGL_INVALID_HANDLE); + + 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 (); +} + +static void +bind_gl_framebuffer (CoglContext *ctx, + GLenum target, + CoglFramebuffer *framebuffer) +{ + if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN) + GE (ctx, glBindFramebuffer (target, + COGL_OFFSCREEN (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)); + } +} + +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) + return COGL_FRAMEBUFFER_STATE_VIEWPORT; + else + return 0; +} + +static unsigned long +_cogl_framebuffer_compare_clip_state (CoglFramebuffer *a, + CoglFramebuffer *b) +{ + if (((a->clip_state.stacks == NULL || b->clip_state.stacks == NULL) && + a->clip_state.stacks != b->clip_state.stacks) + || + a->clip_state.stacks->data != b->clip_state.stacks->data) + 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 (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; + default: + g_warn_if_reached (); + } + } + COGL_FLAGS_FOREACH_END; + + return differences; +} + +static void +_cogl_framebuffer_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_flush_clip_state (CoglFramebuffer *framebuffer) +{ + CoglClipStack *stack = _cogl_clip_state_get_stack (&framebuffer->clip_state); + _cogl_clip_stack_flush (stack, framebuffer); +} + +static void +_cogl_framebuffer_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_flush_modelview_state (CoglFramebuffer *framebuffer) +{ + _cogl_context_set_current_modelview (framebuffer->context, + framebuffer->modelview_stack); +} + +static void +_cogl_framebuffer_flush_projection_state (CoglFramebuffer *framebuffer) +{ + _cogl_context_set_current_projection (framebuffer->context, + framebuffer->projection_stack); +} + +static void +_cogl_framebuffer_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_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_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) + bind_gl_framebuffer (ctx, GL_FRAMEBUFFER, draw_buffer); + else + { + /* NB: Currently we only take advantage of binding separate + * read/write buffers for offscreen framebuffer blit + * purposes. */ + _COGL_RETURN_IF_FAIL (ctx->private_feature_flags & + 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); + + bind_gl_framebuffer (ctx, GL_DRAW_FRAMEBUFFER, draw_buffer); + bind_gl_framebuffer (ctx, GL_READ_FRAMEBUFFER, read_buffer); + } + + 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_flush_viewport_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_CLIP: + _cogl_framebuffer_flush_clip_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_DITHER: + _cogl_framebuffer_flush_dither_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_MODELVIEW: + _cogl_framebuffer_flush_modelview_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_PROJECTION: + _cogl_framebuffer_flush_projection_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK: + _cogl_framebuffer_flush_color_mask_state (draw_buffer); + break; + case COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING: + _cogl_framebuffer_flush_front_face_winding_state (draw_buffer); + break; + default: + g_warn_if_reached (); + } + } + COGL_FLAGS_FOREACH_END; + + ctx->current_draw_buffer_state_flushed |= state; + ctx->current_draw_buffer_changes &= ~state; +} + +int +cogl_framebuffer_get_red_bits (CoglFramebuffer *framebuffer) +{ + _cogl_framebuffer_init_bits (framebuffer); + + return framebuffer->red_bits; +} + +int +cogl_framebuffer_get_green_bits (CoglFramebuffer *framebuffer) +{ + _cogl_framebuffer_init_bits (framebuffer); + + return framebuffer->green_bits; +} + +int +cogl_framebuffer_get_blue_bits (CoglFramebuffer *framebuffer) +{ + _cogl_framebuffer_init_bits (framebuffer); + + return framebuffer->blue_bits; +} + +int +cogl_framebuffer_get_alpha_bits (CoglFramebuffer *framebuffer) +{ + _cogl_framebuffer_init_bits (framebuffer); + + return framebuffer->alpha_bits; +} + +CoglColorMask +cogl_framebuffer_get_color_mask (CoglFramebuffer *framebuffer) +{ + return framebuffer->color_mask; +} + +void +cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer, + CoglColorMask color_mask) +{ + /* 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; +} + +gboolean +cogl_framebuffer_get_dither_enabled (CoglFramebuffer *framebuffer) +{ + return framebuffer->dither_enabled; +} + +void +cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer, + gboolean 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; +} + +CoglPixelFormat +cogl_framebuffer_get_color_format (CoglFramebuffer *framebuffer) +{ + return framebuffer->format; +} + +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 gboolean +_cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap) +{ + gboolean 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) + { + guint8 *pixel; + + /* 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); + if (pixel == NULL) + 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; +} + +gboolean +cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, + int x, + int y, + CoglReadPixelsFlags source, + CoglBitmap *bitmap) +{ + CoglContext *ctx; + int framebuffer_height; + CoglPixelFormat format; + CoglPixelFormat required_format; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + gboolean pack_invert_set; + 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, NULL)) + return FALSE; + + ctx = cogl_framebuffer_get_context (framebuffer); + + 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; + } + + /* make sure any batched primitives get emitted to the GL driver + * before issuing our read pixels... + */ + _cogl_framebuffer_flush_journal (framebuffer); + + _cogl_framebuffer_flush_state (framebuffer, + framebuffer, + COGL_FRAMEBUFFER_STATE_BIND); + + framebuffer_height = cogl_framebuffer_get_height (framebuffer); + + /* 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; + + format = cogl_bitmap_get_format (bitmap); + + required_format = ctx->texture_driver->pixel_format_to_gl (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 ((ctx->private_feature_flags & COGL_PRIVATE_FEATURE_MESA_PACK_INVERT) && + !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 ((ctx->driver != COGL_DRIVER_GL && + (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; + guint8 *tmp_data; + int succeeded; + + if (ctx->driver == COGL_DRIVER_GL) + 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->format & COGL_PREMULT_BIT)); + + tmp_bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, + width, height, + read_format); + 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 (rowstride, bpp); + + tmp_data = _cogl_bitmap_bind (tmp_bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + + GE( ctx, glReadPixels (x, y, width, height, + gl_format, gl_type, + tmp_data) ); + + _cogl_bitmap_unbind (tmp_bmp); + + succeeded = _cogl_bitmap_convert_into_bitmap (tmp_bmp, bitmap); + + cogl_object_unref (tmp_bmp); + + if (!succeeded) + return FALSE; + } + else + { + CoglBitmap *shared_bmp; + CoglPixelFormat bmp_format; + int bpp, rowstride; + gboolean succeeded = FALSE; + guint8 *pixels; + + 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->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 (rowstride, bpp); + + pixels = _cogl_bitmap_bind (shared_bmp, + COGL_BUFFER_ACCESS_WRITE, + 0 /* hints */); + + GE( ctx, glReadPixels (x, y, + width, height, + gl_format, gl_type, + pixels) ); + + _cogl_bitmap_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)) + succeeded = TRUE; + + cogl_object_unref (shared_bmp); + + if (!succeeded) + return FALSE; + } + + /* 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)); + + /* NB: All offscreen rendering is done upside down so there is no need + * to flip in this case... */ + if (!cogl_is_offscreen (framebuffer) && !pack_invert_set) + { + guint8 *temprow; + int rowstride; + guint8 *pixels; + + rowstride = cogl_bitmap_get_rowstride (bitmap); + pixels = _cogl_bitmap_map (bitmap, + COGL_BUFFER_ACCESS_READ | + COGL_BUFFER_ACCESS_WRITE, + 0 /* hints */); + + if (pixels == NULL) + return FALSE; + + temprow = g_alloca (rowstride * sizeof (guint8)); + + /* 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); + } + + return TRUE; +} + +gboolean +cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height, + CoglPixelFormat format, + guint8 *pixels) +{ + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + CoglBitmap *bitmap; + gboolean ret; + + bitmap = cogl_bitmap_new_for_data (framebuffer->context, + width, height, + format, + bpp * width, /* rowstride */ + pixels); + ret = cogl_framebuffer_read_pixels_into_bitmap (framebuffer, + x, y, + COGL_READ_PIXELS_COLOR_BUFFER, + bitmap); + cogl_object_unref (bitmap); + + return ret; +} + +void +_cogl_blit_framebuffer (unsigned int src_x, + unsigned int src_y, + unsigned int dst_x, + unsigned int dst_y, + unsigned int width, + unsigned int height) +{ + CoglFramebuffer *draw_buffer; + CoglFramebuffer *read_buffer; + CoglContext *ctx; + + /* FIXME: this function should take explit src and dst framebuffer + * arguments. */ + draw_buffer = cogl_get_draw_framebuffer (); + read_buffer = _cogl_get_read_framebuffer (); + ctx = draw_buffer->context; + + _COGL_RETURN_IF_FAIL (ctx->private_feature_flags & + 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 (draw_buffer)); + _COGL_RETURN_IF_FAIL (cogl_is_offscreen (read_buffer)); + /* The buffers must be the same format */ + _COGL_RETURN_IF_FAIL (draw_buffer->format == read_buffer->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 (cogl_get_draw_framebuffer (), + _cogl_get_read_framebuffer (), + 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, draw_buffer); + + /* 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); +} + +static void +_cogl_framebuffer_discard_buffers_real (CoglFramebuffer *framebuffer, + unsigned long buffers) +{ +#ifdef GL_EXT_discard_framebuffer + 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_EXT; + if (buffers & COGL_BUFFER_BIT_DEPTH) + attachments[i++] = GL_DEPTH_EXT; + if (buffers & COGL_BUFFER_BIT_STENCIL) + attachments[i++] = GL_STENCIL_EXT; + } + 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; + } + + GE (ctx, glDiscardFramebuffer (GL_FRAMEBUFFER, i, attachments)); + } +#endif /* GL_EXT_discard_framebuffer */ +} + +void +cogl_framebuffer_discard_buffers (CoglFramebuffer *framebuffer, + unsigned long buffers) +{ + _COGL_RETURN_IF_FAIL (buffers & COGL_BUFFER_BIT_COLOR); + + _cogl_framebuffer_discard_buffers_real (framebuffer, buffers); +} + +void +cogl_framebuffer_finish (CoglFramebuffer *framebuffer) +{ + _cogl_framebuffer_flush_journal (framebuffer); + GE (framebuffer->context, glFinish ()); +} + +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_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) +{ + CoglMatrixStack *modelview_stack = + _cogl_framebuffer_get_modelview_stack (framebuffer); + _cogl_matrix_stack_get (modelview_stack, matrix); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_framebuffer_set_modelview_matrix (CoglFramebuffer *framebuffer, + 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) +{ + CoglMatrixStack *projection_stack = + _cogl_framebuffer_get_projection_stack (framebuffer); + _cogl_matrix_stack_get (projection_stack, matrix); + _COGL_MATRIX_DEBUG_PRINT (matrix); +} + +void +cogl_framebuffer_set_projection_matrix (CoglFramebuffer *framebuffer, + 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) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + + clip_state->stacks->data = + _cogl_clip_stack_push_window_rectangle (clip_state->stacks->data, + 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) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + CoglMatrix modelview_matrix; + + cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview_matrix); + + clip_state->stacks->data = + _cogl_clip_stack_push_rectangle (clip_state->stacks->data, + x_1, y_1, x_2, y_2, + &modelview_matrix); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer, + CoglPath *path) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + CoglMatrix modelview_matrix; + + cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview_matrix); + + clip_state->stacks->data = + _cogl_clip_stack_push_from_path (clip_state->stacks->data, + path, + &modelview_matrix); + + 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) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + CoglMatrix modelview_matrix; + + cogl_get_modelview_matrix (&modelview_matrix); + + clip_state->stacks->data = + _cogl_clip_stack_push_primitive (clip_state->stacks->data, + primitive, + bounds_x1, bounds_y1, + bounds_x2, bounds_y2, + &modelview_matrix); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +cogl_framebuffer_pop_clip (CoglFramebuffer *framebuffer) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + + clip_state->stacks->data = _cogl_clip_stack_pop (clip_state->stacks->data); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +_cogl_framebuffer_save_clip_stack (CoglFramebuffer *framebuffer) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + _cogl_clip_state_save_clip_stack (clip_state); + + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_CLIP; +} + +void +_cogl_framebuffer_restore_clip_stack (CoglFramebuffer *framebuffer) +{ + CoglClipState *clip_state = _cogl_framebuffer_get_clip_state (framebuffer); + _cogl_clip_state_restore_clip_stack (clip_state); + + 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 ((guint8 *)indices)[_index]; + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + return ((guint16 *)indices)[_index]; + case COGL_INDICES_TYPE_UNSIGNED_INT: + return ((guint32 *)indices)[_index]; + } + + g_return_val_if_reached (0); +} + +static void +add_line (guint32 *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; + guint32 *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); + 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 gboolean +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) +{ + 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)) + { + CoglSnippet *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); + cogl_object_unref (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! */ + COGL_DEBUG_CLEAR_FLAG (COGL_DEBUG_WIREFRAME); + _cogl_framebuffer_draw_indexed_attributes ( + framebuffer, + wire_pipeline, + COGL_VERTICES_MODE_LINES, + 0, + n_indices, + wire_indices, + attributes, + n_attributes, + COGL_DRAW_SKIP_JOURNAL_FLUSH | + COGL_DRAW_SKIP_PIPELINE_VALIDATION | + COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH | + COGL_DRAW_SKIP_LEGACY_STATE); + 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))) + draw_wireframe (framebuffer->context, + framebuffer, pipeline, + mode, first_vertex, n_vertices, + attributes, n_attributes, NULL); + else +#endif + { + _cogl_flush_attributes_state (framebuffer, pipeline, flags, + attributes, n_attributes); + + GE (framebuffer->context, + glDrawArrays ((GLenum)mode, first_vertex, n_vertices)); + } +} + +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); +} + +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); +} + +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_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))) + draw_wireframe (framebuffer->context, + framebuffer, pipeline, + mode, first_vertex, n_vertices, + attributes, n_attributes, indices); + else +#endif + { + CoglBuffer *buffer; + guint8 *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)); + base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_BUFFER); + 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_unbind (buffer); + } +} + +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); +} + +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, + 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_framebuffer_draw_primitive (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglPrimitive *primitive) +{ + _cogl_framebuffer_draw_primitive (framebuffer, pipeline, primitive, + 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..07886db --- /dev/null +++ b/cogl/cogl-framebuffer.h @@ -0,0 +1,1677 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_FRAMEBUFFER_H +#define __COGL_FRAMEBUFFER_H + +#include + +#ifdef COGL_HAS_WIN32_SUPPORT +#include +#endif /* COGL_HAS_WIN32_SUPPORT */ + +#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +#else +#include +#endif + +#include +#include +#include + +G_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_to_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. + */ + +typedef struct _CoglFramebuffer CoglFramebuffer; + +#ifdef COGL_ENABLE_EXPERIMENTAL_API + +#define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X)) + +/** + * cogl_framebuffer_allocate: + * @framebuffer: A #CoglFramebuffer + * @error: A pointer to a #GError 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 + */ +gboolean +cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, + GError **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: 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 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. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_framebuffer_rotate (CoglFramebuffer *framebuffer, + float angle, + float x, + float y, + float z); + +/** + * 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, + 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, + 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_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); + +/** + * 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 top-left corner of the primitives + * bounds + * @bounds_y2: x coordinate for the bottom-right corner of the + * primitives bounds. + * @bounds_x1: 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_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_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 + */ +gboolean +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, + gboolean dither_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_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_to_texture() this will correspond to the format + * of the texture. + * + * Since: 1.8 + * Stability: unstable + */ +CoglPixelFormat +cogl_framebuffer_get_color_format (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); + +/** + * @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: 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 + */ +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 + */ +void +cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + ...) G_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 + */ +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 + */ +void +cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + ...) G_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 + */ +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_framebuffer_draw_primitive() or + * cogl_framebuffer_draw_attributes() 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_framebuffer_draw_primitive() or + * cogl_framebuffer_draw_attributes() 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 *verts, + unsigned int n_rects); + +/** + * 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_framebuffer_draw_primitive() or + * cogl_framebuffer_draw_attributes() 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 + */ +gboolean +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 + */ +gboolean +cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer, + int x, + int y, + int width, + int height, + CoglPixelFormat format, + guint8 *pixels); + +/** + * cogl_get_draw_framebuffer: + * + * Gets the current #CoglFramebuffer as set using + * cogl_push_framebuffer() + * + * Return value: 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. */ + +GQuark +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 + */ +gboolean +cogl_is_framebuffer (void *object); + +G_END_DECLS + +#endif /* __COGL_FRAMEBUFFER_H */ + diff --git a/cogl/cogl-glib-source.c b/cogl/cogl-glib-source.c new file mode 100644 index 0000000..1cff8e5 --- /dev/null +++ b/cogl/cogl-glib-source.c @@ -0,0 +1,194 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-glib-source.h" +#include "cogl-poll.h" + +typedef struct _CoglGLibSource +{ + GSource source; + + CoglContext *context; + + GArray *poll_fds; + + gint64 expiration_time; +} CoglGLibSource; + +static gboolean +cogl_glib_source_poll_fds_changed (CoglGLibSource *cogl_source, + const CoglPollFD *poll_fds, + int n_poll_fds) +{ + int i; + + if (cogl_source->poll_fds->len != n_poll_fds) + return TRUE; + + for (i = 0; i < n_poll_fds; i++) + if (g_array_index (cogl_source->poll_fds, CoglPollFD, i).fd != + poll_fds[i].fd) + return TRUE; + + return FALSE; +} + +static gboolean +cogl_glib_source_prepare (GSource *source, int *timeout) +{ + CoglGLibSource *cogl_source = (CoglGLibSource *) source; + CoglPollFD *poll_fds; + int n_poll_fds; + gint64 cogl_timeout; + int i; + + cogl_poll_get_info (cogl_source->context, + &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 (cogl_glib_source_poll_fds_changed (cogl_source, poll_fds, n_poll_fds)) + { + /* 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); + } + } + + /* 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 gboolean +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 gboolean +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_dispatch (cogl_source->context, + poll_fds, + cogl_source->poll_fds->len); + + return TRUE; +} + +static void +cogl_glib_source_finalize (GSource *source) +{ + CoglGLibSource *cogl_source = (CoglGLibSource *) source; + + cogl_object_unref (cogl_source->context); + + 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_source_new (CoglContext *context, + int priority) +{ + GSource *source; + CoglGLibSource *cogl_source; + + source = g_source_new (&cogl_glib_source_funcs, + sizeof (CoglGLibSource)); + cogl_source = (CoglGLibSource *) source; + + cogl_source->context = cogl_object_ref (context); + cogl_source->poll_fds = g_array_new (FALSE, FALSE, sizeof (GPollFD)); + + if (priority != G_PRIORITY_DEFAULT) + g_source_set_priority (source, priority); + + return source; +} diff --git a/cogl/cogl-glib-source.h b/cogl/cogl-glib-source.h new file mode 100644 index 0000000..6bd5dd4 --- /dev/null +++ b/cogl/cogl-glib-source.h @@ -0,0 +1,59 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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_get_info() and cogl_poll_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.10 + */ +GSource * +cogl_glib_source_new (CoglContext *context, + int priority); + +G_END_DECLS + +#endif /* __COGL_GSOURCE_H__ */ diff --git a/cogl/cogl-glx-display-private.h b/cogl/cogl-glx-display-private.h new file mode 100644 index 0000000..32ff87b --- /dev/null +++ b/cogl/cogl-glx-display-private.h @@ -0,0 +1,56 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + */ + +#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; + gboolean found; + GLXFBConfig fb_config; + gboolean can_mipmap; +} CoglGLXCachedConfig; + +#define COGL_GLX_N_CACHED_CONFIGS 3 + +typedef struct _CoglGLXDisplay +{ + CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS]; + + gboolean found_fbconfig; + gboolean fbconfig_has_rgba_visual; + GLXFBConfig fbconfig; + + /* Single context for all wins */ + GLXContext glx_context; + GLXWindow dummy_glxwin; + Window dummy_xwin; + gboolean pending_swap_notify; +} 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..d76ef62 --- /dev/null +++ b/cogl/cogl-glx-renderer-private.h @@ -0,0 +1,113 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + */ + +#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; + + gboolean is_direct; + + /* Vblank stuff */ + int dri_fd; + + /* GModule pointing to libGL which we use to get glX functions out of */ + GModule *libgl_module; + + /* 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 */ + void + (* glXDestroyContext) (Display *dpy, GLXContext ctx); + void + (* glXSwapBuffers) (Display *dpy, GLXDrawable drawable); + Bool + (* glXQueryExtension) (Display *dpy, int *errorb, int *event); + const char * + (* glXQueryExtensionsString) (Display *dpy, int screen); + Bool + (* glXQueryVersion) (Display *dpy, int *maj, int *min); + Bool + (* glXIsDirect) (Display *dpy, GLXContext ctx); + int + (* glXGetFBConfigAttrib) (Display *dpy, GLXFBConfig config, + int attribute, int *value); + GLXWindow + (* glXCreateWindow) (Display *dpy, GLXFBConfig config, + Window win, const int *attribList); + void + (* glXDestroyWindow) (Display *dpy, GLXWindow window); + GLXPixmap + (* glXCreatePixmap) (Display *dpy, GLXFBConfig config, + Pixmap pixmap, const int *attribList); + void + (* glXDestroyPixmap) (Display *dpy, GLXPixmap pixmap); + GLXContext + (* glXCreateNewContext) (Display *dpy, GLXFBConfig config, + int renderType, GLXContext shareList, + Bool direct); + Bool + (* glXMakeContextCurrent) (Display *dpy, GLXDrawable draw, + GLXDrawable read, GLXContext ctx); + void + (* glXSelectEvent) (Display *dpy, GLXDrawable drawable, + unsigned long mask); + GLXFBConfig * + (* glXGetFBConfigs) (Display *dpy, int screen, int *nelements); + GLXFBConfig * + (* glXChooseFBConfig) (Display *dpy, int screen, + const int *attrib_list, int *nelements); + XVisualInfo * + (* glXGetVisualFromFBConfig) (Display *dpy, GLXFBConfig config); + + void * + (* glXGetProcAddress) (const GLubyte *procName); + + /* 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-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-gtype-private.h b/cogl/cogl-gtype-private.h new file mode 100644 index 0000000..1d12330 --- /dev/null +++ b/cogl/cogl-gtype-private.h @@ -0,0 +1,48 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + */ + +#include +#include + +#ifndef __COGL_GTYPE_PRIVATE_H__ +#define __COGL_GTYPE_PRIVATE_H__ + +#define COGL_GTYPE_DEFINE_BOXED(Name, underscore_name, copy_func, free_func) \ +GType \ +cogl_gtype_ ## underscore_name ## _get_type (void) \ +{ \ + static volatile gsize type_volatile = 0; \ + if (g_once_init_enter (&type_volatile)) \ + { \ + GType type = \ + g_boxed_type_register_static (g_intern_static_string ("Cogl" Name), \ + (GBoxedCopyFunc)copy_func, \ + (GBoxedFreeFunc)free_func); \ + g_once_init_leave (&type_volatile, type); \ + } \ + return type_volatile; \ +} + +#endif /* __COGL_GTYPE_PRIVATE_H__ */ + diff --git a/cogl/cogl-handle.h b/cogl/cogl-handle.h new file mode 100644 index 0000000..f69e97e --- /dev/null +++ b/cogl/cogl-handle.h @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + */ + +/* This file is just kept for compatability while we eradicate + * CoglHandle + */ + +#ifndef __COGL_HANDLE_H +#define __COGL_HANDLE_H + +#include "cogl-object-private.h" + +#endif /* __COGL_HANDLE_H */ + diff --git a/cogl/cogl-index-buffer-private.h b/cogl/cogl-index-buffer-private.h new file mode 100644 index 0000000..defe1e9 --- /dev/null +++ b/cogl/cogl-index-buffer-private.h @@ -0,0 +1,38 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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..557d770 --- /dev/null +++ b/cogl/cogl-index-buffer.c @@ -0,0 +1,111 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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" + +static void _cogl_index_buffer_free (CoglIndexBuffer *indices); + +COGL_BUFFER_DEFINE (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, gsize bytes) +{ + CoglIndexBuffer *indices = g_slice_new (CoglIndexBuffer); + gboolean use_malloc; + + if (!(context->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS)) + use_malloc = TRUE; + else + use_malloc = FALSE; + + /* parent's constructor */ + _cogl_buffer_initialize (COGL_BUFFER (indices), + context, + bytes, + use_malloc, + 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, + gsize 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..2e64ab3 --- /dev/null +++ b/cogl/cogl-index-buffer.h @@ -0,0 +1,85 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_INDEX_BUFFER_H__ +#define __COGL_INDEX_BUFFER_H__ + +#include + +G_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; + +/** + * 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(). + * + * Since: 1.4 + * Stability: Unstable + */ +CoglIndexBuffer * +cogl_index_buffer_new (CoglContext *context, + gsize bytes); + +/** + * cogl_is_index_buffer: + * @object: A #CoglObject + * + * Gets whether the given object references a #CoglIndexBuffer. + * + * Returns: %TRUE if the handle references a #CoglIndexBuffer, + * %FALSE otherwise + * + * Since: 1.4 + * Stability: Unstable + */ +gboolean +cogl_is_index_buffer (void *object); + +G_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..766bc2c --- /dev/null +++ b/cogl/cogl-indices-private.h @@ -0,0 +1,54 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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..c99985c --- /dev/null +++ b/cogl/cogl-indices.c @@ -0,0 +1,255 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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 + +static void _cogl_indices_free (CoglIndices *indices); + +COGL_OBJECT_DEFINE (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, + gsize 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; + + cogl_buffer_set_data (buffer, + 0, + indices_data, + buffer_bytes); + + 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; +} + +gsize +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 gboolean seen = FALSE; + if (!seen) + { + g_warning ("Mid-scene modification of indices has " + "undefined results\n"); + seen = TRUE; + } +} + +void +cogl_indices_set_offset (CoglIndices *indices, + gsize 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) + { + guint8 *byte_array = g_malloc (256 / 4 * 6 * sizeof (guint8)); + guint8 *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) + { + guint16 *short_array; + guint16 *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 (guint16)); + + /* 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..23cc911 --- /dev/null +++ b/cogl/cogl-indices.h @@ -0,0 +1,146 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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 + +G_BEGIN_DECLS + +/** + * SECTION:cogl-index-range + * @short_description: Fuctions for declaring a range of 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 squence 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. + */ + +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, + gsize offset); + +CoglIndexBuffer * +cogl_indices_get_buffer (CoglIndices *indices); + +CoglIndicesType +cogl_indices_get_type (CoglIndices *indices); + +gsize +cogl_indices_get_offset (CoglIndices *indices); + +void +cogl_indices_set_offset (CoglIndices *indices, + gsize 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 + */ +gboolean +cogl_is_indices (void *object); + +G_END_DECLS + +#endif /* __COGL_INDICES_H__ */ + diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h new file mode 100644 index 0000000..9019859 --- /dev/null +++ b/cogl/cogl-internal.h @@ -0,0 +1,120 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_INTERNAL_H +#define __COGL_INTERNAL_H + +#include "cogl-bitmask.h" + +#ifdef COGL_HAS_XLIB_SUPPORT +#include +#endif + +#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 */ + +#define COGL_ENABLE_ALPHA_TEST (1<<1) +#define COGL_ENABLE_VERTEX_ARRAY (1<<2) +#define COGL_ENABLE_COLOR_ARRAY (1<<3) + +void +_cogl_enable (unsigned long flags); + +unsigned long +_cogl_get_enable (void); + +void +_cogl_transform_point (const CoglMatrix *matrix_mv, + const CoglMatrix *matrix_p, + const float *viewport, + float *x, + float *y); + +#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; + +typedef enum +{ + COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE = 1L<<0, + COGL_PRIVATE_FEATURE_MESA_PACK_INVERT = 1L<<1, + COGL_PRIVATE_FEATURE_STENCIL_BUFFER = 1L<<2, + COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT = 1L<<3, + COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES = 1L<<4, + COGL_PRIVATE_FEATURE_PBOS = 1L<<5, + COGL_PRIVATE_FEATURE_VBOS = 1L<<6, + COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL = 1L<<7, + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL = 1L<<8 +} CoglPrivateFeatureFlags; + +/* 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; + +gboolean +_cogl_check_extension (const char *name, const char *ext); + +GQuark +_cogl_driver_error_quark (void); + +#endif /* __COGL_INTERNAL_H */ diff --git a/cogl/cogl-journal-private.h b/cogl/cogl-journal-private.h new file mode 100644 index 0000000..90363cd --- /dev/null +++ b/cogl/cogl-journal-private.h @@ -0,0 +1,114 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_JOURNAL_PRIVATE_H +#define __COGL_JOURNAL_PRIVATE_H + +#include "cogl-texture.h" +#include "cogl-handle.h" +#include "cogl-clip-stack.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; + +} 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; + int n_layers; + CoglMatrix model_view; + CoglClipStack *clip_stack; + /* Offset into ctx->logged_vertices */ + size_t array_offset; + /* XXX: These entries are pretty big now considering the padding in + * CoglPipelineFlushOptions and CoglMatrix, so we might need to optimize this + * later. */ +} 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); + +gboolean +_cogl_journal_all_entries_within_bounds (CoglJournal *journal, + float clip_x0, + float clip_y0, + float clip_x1, + float clip_y1); + +gboolean +_cogl_journal_try_read_pixel (CoglJournal *journal, + int x, + int y, + CoglBitmap *bitmap, + gboolean *found_intersection); + +gboolean +_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..7b7a3e9 --- /dev/null +++ b/cogl/cogl-journal.c @@ -0,0 +1,1885 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-internal.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 +{ + CoglJournal *journal; + + CoglAttributeBuffer *attribute_buffer; + GArray *attributes; + int current_attribute; + + gsize stride; + size_t array_offset; + GLuint current_vertex; + + CoglIndices *indices; + gsize indices_type_size; + + CoglMatrixStack *modelview_stack; + CoglMatrixStack *projection_stack; + + CoglPipeline *pipeline; +} CoglJournalFlushState; + +typedef void (*CoglJournalBatchCallback) (CoglJournalEntry *start, + int n_entries, + void *data); +typedef gboolean (*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)); + + return _cogl_journal_object_new (journal); +} + +static void +_cogl_journal_dump_logged_quad (guint8 *data, int n_layers) +{ + gsize stride = GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (n_layers); + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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 (guint8 *data, int n_layers) +{ + gsize stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers); + int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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); + guint8 *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 (guint8 *data, int n_layers, int n_quads) +{ + gsize 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; + 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_GET_CONTEXT (ctx, NO_RETVAL); + + 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_matrix_stack_set (state->modelview_stack, + &batch_start->model_view); + _cogl_context_set_current_modelview (ctx, state->modelview_stack); + } + + 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 (ctx->driver == COGL_DRIVER_GL) + { + /* 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; + guint8 color_intensity; + int i; + CoglAttribute *loop_attributes[1]; + + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + if (outline == NULL) + outline = cogl_pipeline_new (ctxt); + + /* 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 * (ctxt->journal_rectangles_color >> 3); + cogl_pipeline_set_color4ub (outline, + (ctxt->journal_rectangles_color & 1) ? + color_intensity : 0, + (ctxt->journal_rectangles_color & 2) ? + color_intensity : 0, + (ctxt->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 + ctxt->journal_rectangles_color = ((ctxt->journal_rectangles_color + 1) & + ((1 << 5) - 1)); + /* We don't want to use black or white */ + while ((ctxt->journal_rectangles_color & 0x07) == 0 + || (ctxt->journal_rectangles_color & 0x07) == 0x07); + } + + state->current_vertex += (4 * batch_len); + + COGL_TIMER_STOP (_cogl_uprof_context, time_flush_modelview_and_entries); +} + +static gboolean +compare_entry_modelviews (CoglJournalEntry *entry0, + CoglJournalEntry *entry1) +{ + /* Batch together quads with the same model view matrix */ + + /* FIXME: this is nasty, there are much nicer ways to track this + * (at the add_quad_vertices level) without resorting to a memcmp! + * + * E.g. If the cogl-current-matrix code maintained an "age" for + * the modelview matrix we could simply check in add_quad_vertices + * if the age has increased, and if so record the change as a + * boolean in the journal. + */ + + if (memcmp (&entry0->model_view, &entry1->model_view, + sizeof (GLfloat) * 16) == 0) + return TRUE; + else + return FALSE; +} + +/* 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_GET_CONTEXT (ctx, NO_RETVAL); + + 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 gboolean +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; +} + +/* 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; + 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_GET_CONTEXT (ctx, NO_RETVAL); + + 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); + + for (i = 0; i < batch_start->n_layers; i++) + { + CoglAttribute **attribute_entry = + &g_array_index (state->attributes, CoglAttribute *, i + 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 = i < 8 ? (char *)names[i] : + g_strdup_printf ("cogl_tex_coord%d_in", i); + + /* XXX: it may be worth having some form of static initializer for + * attributes... */ + *attribute_entry = + cogl_attribute_new (state->attribute_buffer, + name, + state->stride, + state->array_offset + + (POS_STRIDE + COLOR_STRIDE) * 4 + + TEX_STRIDE * 4 * i, + 2, + COGL_ATTRIBUTE_TYPE_FLOAT); + + if (i >= 8) + g_free (name); + } + + 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 gboolean +compare_entry_n_layers (CoglJournalEntry *entry0, CoglJournalEntry *entry1) +{ + if (entry0->n_layers == entry1->n_layers) + 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; + gsize 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 (ctx->driver != COGL_DRIVER_GL) + 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))) + { + guint8 *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 = ((guint8 *)cogl_buffer_map (COGL_BUFFER (state->attribute_buffer), + COGL_BUFFER_ACCESS_READ, 0) + + 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_n_layers, + _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 gboolean +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; + + 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_GET_CONTEXT (ctx, NO_RETVAL); + + 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, state->journal->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; + + _cogl_matrix_stack_push (state->modelview_stack); + + /* 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 matrix */ + if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))) + { + _cogl_matrix_stack_load_identity (state->modelview_stack); + _cogl_context_set_current_modelview (ctx, state->modelview_stack); + } + + /* Setting up the clip state can sometimes also flush the projection + matrix so we should flush it again. This will be a no-op if the + clip code didn't modify the projection */ + _cogl_context_set_current_projection (ctx, state->projection_stack); + + batch_and_call (batch_start, + batch_len, + compare_entry_strides, + _cogl_journal_flush_vbo_offsets_and_entries, /* callback */ + data); + + _cogl_matrix_stack_pop (state->modelview_stack); + + COGL_TIMER_STOP (_cogl_uprof_context, + time_flush_clip_stack_pipeline_entries); +} + +static gboolean +calculate_translation (const CoglMatrix *a, + const CoglMatrix *b, + float *tx_p, + float *ty_p) +{ + float tx, ty; + int x, y; + + /* Assuming we had the original matrix in this form: + * + * [ a₁₁, a₁₂, a₁₃, a₁₄ ] + * [ a₂₁, a₂₂, a₂₃, a₂₄ ] + * a = [ a₃₁, a₃₂, a₃₃, a₃₄ ] + * [ a₄₁, a₄₂, a₄₃, a₄₄ ] + * + * then a translation of that matrix would be a multiplication by a + * matrix of this form: + * + * [ 1, 0, 0, x ] + * [ 0, 1, 0, y ] + * t = [ 0, 0, 1, 0 ] + * [ 0, 0, 0, 1 ] + * + * That would give us a matrix of this form. + * + * [ a₁₁, a₁₂, a₁₃, a₁₁ x + a₁₂ y + a₁₄ ] + * [ a₂₁, a₂₂, a₂₃, a₂₁ x + a₂₂ y + a₂₄ ] + * b = a ⋅ t = [ a₃₁, a₃₂, a₃₃, a₃₁ x + a₃₂ y + a₃₄ ] + * [ a₄₁, a₄₂, a₄₃, a₄₁ x + a₄₂ y + a₄₄ ] + * + * We can use the two equations from the top left of the matrix to + * work out the x and y translation given the two matrices: + * + * b₁₄ = a₁₁x + a₁₂y + a₁₄ + * b₂₄ = a₂₁x + a₂₂y + a₂₄ + * + * Rearranging gives us: + * + * a₁₂ b₂₄ - a₂₄ a₁₂ + * ----------------- + a₁₄ - b₁₄ + * a₂₂ + * x = --------------------------------- + * a₁₂ a₂₁ + * ------- - a₁₁ + * a₂₂ + * + * b₂₄ - a₂₁x - a₂₄ + * y = ---------------- + * a₂₂ + * + * Once we've worked out what x and y would be if this was a valid + * translation then we can simply verify that the rest of the matrix + * matches up. + */ + + /* The leftmost 3x4 part of the matrix shouldn't change by a + translation so we can just compare it directly */ + for (y = 0; y < 4; y++) + for (x = 0; x < 3; x++) + if ((&a->xx)[x * 4 + y] != (&b->xx)[x * 4 + y]) + return FALSE; + + tx = (((a->xy * b->yw - a->yw * a->xy) / a->yy + a->xw - b->xw) / + ((a->xy * a->yx) / a->yy - a->xx)); + ty = (b->yw - a->yx * tx - a->yw) / a->yy; + +#define APPROX_EQUAL(a, b) (fabsf ((a) - (b)) < 1e-6f) + + /* Check whether the 4th column of the matrices match up to the + calculation */ + if (!APPROX_EQUAL (b->xw, a->xx * tx + a->xy * ty + a->xw) || + !APPROX_EQUAL (b->yw, a->yx * tx + a->yy * ty + a->yw) || + !APPROX_EQUAL (b->zw, a->zx * tx + a->zy * ty + a->zw) || + !APPROX_EQUAL (b->ww, a->wx * tx + a->wy * ty + a->ww)) + return FALSE; + +#undef APPROX_EQUAL + + *tx_p = tx; + *ty_p = ty; + + return TRUE; +} + +typedef struct +{ + float x_1, y_1; + float x_2, y_2; +} ClipBounds; + +static gboolean +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; + + clip_rect = (CoglClipStackRect *) clip_entry; + + if (!calculate_translation (&clip_rect->matrix, + &journal_entry->model_view, + &tx, &ty)) + 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) +{ + CoglJournal *journal = state->journal; + CoglClipStack *clip_stack, *clip_entry; + int entry_num; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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; + + /* 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_GET_CONTEXT (ctx, NO_RETVAL); + + 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 gboolean +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, + gsize n_bytes) +{ + CoglAttributeBuffer *vbo; + + _COGL_GET_CONTEXT (ctx, NULL); + + /* 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 (!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_VBOS)) + return cogl_attribute_buffer_new (ctx, n_bytes, NULL); + + vbo = journal->vbo_pool[journal->next_vbo_in_pool]; + + if (vbo == NULL) + { + vbo = cogl_attribute_buffer_new (ctx, n_bytes, NULL); + 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 (ctx, n_bytes, NULL); + 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; + + 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_for_fill_or_fallback (buffer); + 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]; + + cogl_matrix_transform_points (&entry->model_view, + 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_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' */ +gboolean +_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++) + { + gboolean 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; +} + +/* 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) +{ + CoglJournalFlushState state; + int i; + CoglMatrixStack *modelview_stack; + COGL_STATIC_TIMER (flush_timer, + "Mainloop", /* parent */ + "Journal Flush", + "The time spent flushing the Cogl journal", + 0 /* no application private data */); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (journal->entries->len == 0) + return; + + /* 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 (journal->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 (journal->framebuffer, + journal->framebuffer, + COGL_FRAMEBUFFER_STATE_ALL & + ~(COGL_FRAMEBUFFER_STATE_MODELVIEW | + COGL_FRAMEBUFFER_STATE_CLIP)); + + state.journal = journal; + + state.attributes = ctx->journal_flush_attributes_array; + + modelview_stack = + _cogl_framebuffer_get_modelview_stack (journal->framebuffer); + state.modelview_stack = modelview_stack; + state.projection_stack = + _cogl_framebuffer_get_projection_stack (journal->framebuffer); + + 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_journal_discard (journal); + + COGL_TIMER_STOP (_cogl_uprof_context, flush_timer); +} + +static gboolean +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; + gsize stride; + int next_vert; + float *v; + int i; + int next_entry; + guint32 disable_layers; + CoglJournalEntry *entry; + CoglPipeline *final_pipeline; + CoglClipStack *clip_stack; + CoglPipelineFlushOptions flush_options; + 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); + + /* 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, (guint8 *) 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 ((guint8 *)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_handle_unref (final_pipeline); + + cogl_framebuffer_get_modelview_matrix (framebuffer, + &entry->model_view); + + _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; + 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_transform_points (&entry->model_view, + 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 gboolean +try_checking_point_hits_entry_after_clipping (CoglFramebuffer *framebuffer, + CoglJournalEntry *entry, + float *vertices, + float x, + float y, + gboolean *hit) +{ + gboolean can_software_clip = TRUE; + gboolean 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; +} + +gboolean +_cogl_journal_try_read_pixel (CoglJournal *journal, + int x, + int y, + CoglBitmap *bitmap, + gboolean *found_intersection) +{ + CoglPixelFormat format; + int i; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* 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; + + *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); + guint8 *color = (guint8 *)&g_array_index (journal->vertices, float, + entry->array_offset); + float *vertices = (float *)color + 1; + float poly[16]; + CoglFramebuffer *framebuffer = journal->framebuffer; + guint8 *pixel; + + 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) + { + gboolean 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); + if (pixel == NULL) + 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-renderer.h b/cogl/cogl-kms-renderer.h new file mode 100644 index 0000000..68d126e --- /dev/null +++ b/cogl/cogl-kms-renderer.h @@ -0,0 +1,51 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_KMS_RENDERER_H__ +#define __COGL_KMS_RENDERER_H__ + +#include +#include + +G_BEGIN_DECLS + +/** + * 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); + +G_END_DECLS +#endif /* __COGL_KMS_RENDERER_H__ */ diff --git a/cogl/cogl-material-compat.c b/cogl/cogl-material-compat.c new file mode 100644 index 0000000..2e71928 --- /dev/null +++ b/cogl/cogl-material-compat.c @@ -0,0 +1,454 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * 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); +} + +gboolean +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, + guint8 red, + guint8 green, + guint8 blue, + guint8 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); +} + +gboolean +cogl_material_set_blend (CoglMaterial *material, + const char *blend_string, + GError **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); +} + +gboolean +cogl_material_set_layer_combine (CoglMaterial *material, + int layer_index, + const char *blend_string, + GError **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); +} + +gboolean +cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, + int layer_index, + gboolean enable, + GError **error) +{ + CoglPipeline *pipeline = COGL_PIPELINE (material); + return cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline, + layer_index, + enable, + error); +} + +gboolean +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); +} + +gboolean +cogl_material_set_depth_state (CoglMaterial *material, + const CoglDepthState *state, + GError **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/cogl-material-compat.h b/cogl/cogl-material-compat.h new file mode 100644 index 0000000..f07bb69 --- /dev/null +++ b/cogl/cogl-material-compat.h @@ -0,0 +1,1275 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_MATERIAL_H__ +#define __COGL_MATERIAL_H__ + +#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 + */ +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 + */ +CoglMaterial * +cogl_material_copy (CoglMaterial *source); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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 + */ +CoglHandle +cogl_material_ref (CoglHandle material) G_GNUC_DEPRECATED; + +/** + * 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 + */ +void +cogl_material_unref (CoglHandle material) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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 + */ +gboolean +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 + */ +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 + */ +void +cogl_material_set_color4ub (CoglMaterial *material, + guint8 red, + guint8 green, + guint8 blue, + guint8 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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 #GError 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 + */ +gboolean +cogl_material_set_blend (CoglMaterial *material, + const char *blend_string, + GError **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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 #GError 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 + */ +gboolean +cogl_material_set_layer_combine (CoglMaterial *material, + int layer_index, + const char *blend_string, + GError **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 + */ +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. + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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%. + */ +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 GError, 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 + */ +gboolean +cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, + int layer_index, + gboolean enable, + GError **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 + */ +gboolean +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 #GError 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 + */ +gboolean +cogl_material_set_depth_state (CoglMaterial *material, + const CoglDepthState *state, + GError **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 + */ +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 + */ +typedef gboolean (*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 + */ +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/cogl-matrix-private.h b/cogl/cogl-matrix-private.h new file mode 100644 index 0000000..1bdea7b --- /dev/null +++ b/cogl/cogl-matrix-private.h @@ -0,0 +1,47 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_MATRIX_PRIVATE_H +#define __COGL_MATRIX_PRIVATE_H + +#include + +G_BEGIN_DECLS + +#define _COGL_MATRIX_DEBUG_PRINT(MATRIX) \ + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \ + { \ + g_print ("%s:\n", G_STRFUNC); \ + _cogl_matrix_print (MATRIX); \ + } + +void +_cogl_matrix_print (const CoglMatrix *matrix); + +G_END_DECLS + +#endif /* __COGL_MATRIX_PRIVATE_H */ + diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c new file mode 100644 index 0000000..5933bcf --- /dev/null +++ b/cogl/cogl-matrix-stack.c @@ -0,0 +1,556 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009,2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Havoc Pennington for litl + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-internal.h" +#include "cogl-matrix-stack.h" +#include "cogl-framebuffer-private.h" +#include "cogl-object-private.h" +#include "cogl-offscreen.h" + +typedef struct { + CoglMatrix matrix; + gboolean is_identity; + /* count of pushes with no changes; when a change is + * requested, we create a new state and decrement this + */ + int push_count; +} CoglMatrixState; + +/** + * CoglMatrixStack: + * + * Stores a cogl-side matrix stack, which we use as a cache + * so we can get the matrix efficiently when using indirect + * rendering. + */ +struct _CoglMatrixStack +{ + CoglObject _parent; + + GArray *stack; + + unsigned int age; +}; + +static void _cogl_matrix_stack_free (CoglMatrixStack *stack); + +COGL_OBJECT_INTERNAL_DEFINE (MatrixStack, matrix_stack); + +/* XXX: this doesn't initialize the matrix! */ +static void +_cogl_matrix_state_init (CoglMatrixState *state) +{ + state->push_count = 0; + state->is_identity = FALSE; +} + +static CoglMatrixState * +_cogl_matrix_stack_top (CoglMatrixStack *stack) +{ + return &g_array_index (stack->stack, CoglMatrixState, stack->stack->len - 1); +} + +/* XXX: + * Operations like scale, translate, rotate etc need to have an + * initialized state->matrix to work with, so they will pass + * initialize = TRUE. + * + * _cogl_matrix_stack_load_identity and _cogl_matrix_stack_set on the + * other hand don't so they will pass initialize = FALSE + * + * NB: Identity matrices are represented by setting + * state->is_identity=TRUE in which case state->matrix will be + * uninitialized. + */ +static CoglMatrixState * +_cogl_matrix_stack_top_mutable (CoglMatrixStack *stack, + gboolean initialize) +{ + CoglMatrixState *state; + CoglMatrixState *new_top; + + state = _cogl_matrix_stack_top (stack); + + if (state->push_count == 0) + { + if (state->is_identity && initialize) + cogl_matrix_init_identity (&state->matrix); + return state; + } + + state->push_count -= 1; + + g_array_set_size (stack->stack, stack->stack->len + 1); + /* if g_array_set_size reallocs we need to get state + * pointer again */ + state = &g_array_index (stack->stack, CoglMatrixState, + stack->stack->len - 2); + new_top = _cogl_matrix_stack_top(stack); + _cogl_matrix_state_init (new_top); + + if (initialize) + { + if (state->is_identity) + cogl_matrix_init_identity (&new_top->matrix); + else + new_top->matrix = state->matrix; + } + + return new_top; +} + +CoglMatrixStack* +_cogl_matrix_stack_new (void) +{ + CoglMatrixStack *stack; + CoglMatrixState *state; + + stack = g_slice_new0 (CoglMatrixStack); + + stack->stack = g_array_sized_new (FALSE, FALSE, + sizeof (CoglMatrixState), 10); + g_array_set_size (stack->stack, 1); + state = &g_array_index (stack->stack, CoglMatrixState, 0); + _cogl_matrix_state_init (state); + state->is_identity = TRUE; + + stack->age = 0; + + return _cogl_matrix_stack_object_new (stack); +} + +static void +_cogl_matrix_stack_free (CoglMatrixStack *stack) +{ + g_array_free (stack->stack, TRUE); + g_slice_free (CoglMatrixStack, stack); +} + +void +_cogl_matrix_stack_push (CoglMatrixStack *stack) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top (stack); + + /* we lazily create a new stack top if someone changes the matrix + * while push_count > 0 + */ + state->push_count += 1; +} + +void +_cogl_matrix_stack_pop (CoglMatrixStack *stack) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top (stack); + + if (state->push_count > 0) + { + state->push_count -= 1; + } + else + { + if (stack->stack->len == 1) + { + g_warning ("Too many matrix pops"); + return; + } + + stack->age++; + g_array_set_size (stack->stack, stack->stack->len - 1); + } +} + +void +_cogl_matrix_stack_load_identity (CoglMatrixStack *stack) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, FALSE); + + /* NB: Identity matrices are represented by setting + * state->is_identity = TRUE and leaving state->matrix + * uninitialized. + * + * This is done to optimize the heavy usage of + * _cogl_matrix_stack_load_identity by the Cogl Journal. + */ + if (!state->is_identity) + { + state->is_identity = TRUE; + stack->age++; + } +} + +void +_cogl_matrix_stack_scale (CoglMatrixStack *stack, + float x, + float y, + float z) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + cogl_matrix_scale (&state->matrix, x, y, z); + state->is_identity = FALSE; + stack->age++; +} + +void +_cogl_matrix_stack_translate (CoglMatrixStack *stack, + float x, + float y, + float z) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + cogl_matrix_translate (&state->matrix, x, y, z); + state->is_identity = FALSE; + stack->age++; +} + +void +_cogl_matrix_stack_rotate (CoglMatrixStack *stack, + float angle, + float x, + float y, + float z) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + cogl_matrix_rotate (&state->matrix, angle, x, y, z); + state->is_identity = FALSE; + stack->age++; +} + +void +_cogl_matrix_stack_multiply (CoglMatrixStack *stack, + const CoglMatrix *matrix) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + cogl_matrix_multiply (&state->matrix, &state->matrix, matrix); + state->is_identity = FALSE; + stack->age++; +} + +void +_cogl_matrix_stack_frustum (CoglMatrixStack *stack, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + cogl_matrix_frustum (&state->matrix, + left, right, bottom, top, + z_near, z_far); + state->is_identity = FALSE; + stack->age++; +} + +void +_cogl_matrix_stack_perspective (CoglMatrixStack *stack, + float fov_y, + float aspect, + float z_near, + float z_far) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + cogl_matrix_perspective (&state->matrix, + fov_y, aspect, z_near, z_far); + state->is_identity = FALSE; + stack->age++; +} + +void +_cogl_matrix_stack_ortho (CoglMatrixStack *stack, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + cogl_matrix_ortho (&state->matrix, + left, right, bottom, top, z_near, z_far); + state->is_identity = FALSE; + stack->age++; +} + +gboolean +_cogl_matrix_stack_get_inverse (CoglMatrixStack *stack, + CoglMatrix *inverse) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + + return cogl_matrix_get_inverse (&state->matrix, inverse); +} + +void +_cogl_matrix_stack_get (CoglMatrixStack *stack, + CoglMatrix *matrix) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top (stack); + + /* NB: identity matrices are lazily initialized because we can often avoid + * initializing them at all if nothing is pushed on top of them since we + * load them using glLoadIdentity() + * + * The Cogl journal typically loads an identiy matrix because it performs + * software transformations, which is why we have optimized this case. + */ + if (state->is_identity) + cogl_matrix_init_identity (matrix); + else + *matrix = state->matrix; +} + +void +_cogl_matrix_stack_set (CoglMatrixStack *stack, + const CoglMatrix *matrix) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, FALSE); + state->matrix = *matrix; + state->is_identity = FALSE; + stack->age++; +} + +static void +_cogl_matrix_stack_flush_matrix_to_gl_builtin (CoglContext *ctx, + gboolean is_identity, + CoglMatrix *matrix, + CoglMatrixMode mode) +{ + g_assert (ctx->driver == COGL_DRIVER_GL || + ctx->driver == COGL_DRIVER_GLES1); + +#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_stack_flush_to_gl_builtins (CoglContext *ctx, + CoglMatrixStack *stack, + CoglMatrixMode mode, + gboolean disable_flip) +{ + g_assert (ctx->driver == COGL_DRIVER_GL || + ctx->driver == COGL_DRIVER_GLES1); + +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + { + gboolean needs_flip; + CoglMatrixState *state; + CoglMatrixStackCache *cache; + + state = _cogl_matrix_stack_top (stack); + + 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 (ctx->current_draw_buffer); + + 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_stack_check_and_update_cache (stack, cache, needs_flip)) + { + gboolean is_identity = state->is_identity && !needs_flip; + + if (needs_flip) + { + CoglMatrix flipped_matrix; + + cogl_matrix_multiply (&flipped_matrix, + &ctx->y_flip_matrix, + state->is_identity ? + &ctx->identity_matrix : + &state->matrix); + + _cogl_matrix_stack_flush_matrix_to_gl_builtin (ctx, + /* not identity */ + FALSE, + &flipped_matrix, + mode); + } + else + _cogl_matrix_stack_flush_matrix_to_gl_builtin (ctx, + is_identity, + &state->matrix, + mode); + } + } +#endif +} + +unsigned int +_cogl_matrix_stack_get_age (CoglMatrixStack *stack) +{ + return stack->age; +} + +gboolean +_cogl_matrix_stack_has_identity_flag (CoglMatrixStack *stack) +{ + return _cogl_matrix_stack_top (stack)->is_identity; +} + +gboolean +_cogl_matrix_stack_equal (CoglMatrixStack *stack0, + CoglMatrixStack *stack1) +{ + CoglMatrixState *state0 = _cogl_matrix_stack_top (stack0); + CoglMatrixState *state1 = _cogl_matrix_stack_top (stack1); + + if (state0->is_identity != state1->is_identity) + return FALSE; + + if (state0->is_identity) + return TRUE; + else + return cogl_matrix_equal (&state0->matrix, &state1->matrix); +} + +gboolean +_cogl_matrix_stack_check_and_update_cache (CoglMatrixStack *stack, + CoglMatrixStackCache *cache, + gboolean flip) +{ + gboolean is_identity = + _cogl_matrix_stack_has_identity_flag (stack) && !flip; + gboolean is_dirty; + + if (is_identity && cache->flushed_identity) + is_dirty = FALSE; + else if (cache->stack == NULL || + cache->stack->age != cache->age || + flip != cache->flipped) + is_dirty = TRUE; + else + is_dirty = (cache->stack != stack && + !_cogl_matrix_stack_equal (cache->stack, stack)); + + /* We'll update the cache values even if the stack isn't dirty in + case the reason it wasn't dirty is because we compared the + matrices and found them to be the same. In that case updating the + cache values will avoid the comparison next time */ + cache->age = stack->age; + cogl_object_ref (stack); + if (cache->stack) + cogl_object_unref (cache->stack); + cache->stack = stack; + cache->flushed_identity = is_identity; + cache->flipped = flip; + + return is_dirty; +} + +void +_cogl_matrix_stack_init_cache (CoglMatrixStackCache *cache) +{ + cache->stack = NULL; + cache->flushed_identity = FALSE; +} + +void +_cogl_matrix_stack_destroy_cache (CoglMatrixStackCache *cache) +{ + if (cache->stack) + cogl_object_unref (cache->stack); +} diff --git a/cogl/cogl-matrix-stack.h b/cogl/cogl-matrix-stack.h new file mode 100644 index 0000000..7a1417e --- /dev/null +++ b/cogl/cogl-matrix-stack.h @@ -0,0 +1,153 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Havoc Pennington for litl + * Robert Bragg + */ + +#ifndef __COGL_MATRIX_STACK_H +#define __COGL_MATRIX_STACK_H + +#include "cogl-matrix.h" +#include "cogl-context.h" + +typedef struct _CoglMatrixStack CoglMatrixStack; + +typedef struct +{ + CoglMatrixStack *stack; + unsigned int age; + gboolean flushed_identity; + gboolean flipped; +} CoglMatrixStackCache; + +typedef enum { + COGL_MATRIX_MODELVIEW, + COGL_MATRIX_PROJECTION, + COGL_MATRIX_TEXTURE +} CoglMatrixMode; + +typedef void (* CoglMatrixStackFlushFunc) (CoglContext *context, + gboolean is_identity, + const CoglMatrix *matrix, + void *user_data); + +CoglMatrixStack * +_cogl_matrix_stack_new (void); + +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_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_ortho (CoglMatrixStack *stack, + float left, + float right, + float bottom, + float top, + float z_near, + float z_far); +gboolean +_cogl_matrix_stack_get_inverse (CoglMatrixStack *stack, + CoglMatrix *inverse); +void +_cogl_matrix_stack_get (CoglMatrixStack *stack, + CoglMatrix *matrix); +void +_cogl_matrix_stack_set (CoglMatrixStack *stack, + const CoglMatrix *matrix); + +void +_cogl_matrix_stack_flush_to_gl_builtins (CoglContext *ctx, + CoglMatrixStack *stack, + CoglMatrixMode mode, + gboolean disable_flip); + +unsigned int +_cogl_matrix_stack_get_age (CoglMatrixStack *stack); + +/* If this returns TRUE then the top of the matrix 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. */ +gboolean +_cogl_matrix_stack_has_identity_flag (CoglMatrixStack *stack); + +gboolean +_cogl_matrix_stack_equal (CoglMatrixStack *stack0, + CoglMatrixStack *stack1); + +void +_cogl_matrix_stack_init_cache (CoglMatrixStackCache *cache); + +gboolean +_cogl_matrix_stack_check_and_update_cache (CoglMatrixStack *stack, + CoglMatrixStackCache *cache, + gboolean flip); + +void +_cogl_matrix_stack_destroy_cache (CoglMatrixStackCache *cache); + +gboolean +_cogl_is_matrix_stack (void *object); + +#endif /* __COGL_MATRIX_STACK_H */ diff --git a/cogl/cogl-matrix.c b/cogl/cogl-matrix.c new file mode 100644 index 0000000..a346a5c --- /dev/null +++ b/cogl/cogl-matrix.c @@ -0,0 +1,2149 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009,2010,2011 Intel Corporation. + * + * 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, see . + * + * 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 + +#ifdef _COGL_SUPPORTS_GTYPE_INTEGRATION +#include +COGL_GTYPE_DEFINE_BOXED ("Matrix", matrix, + cogl_matrix_copy, + cogl_matrix_free); +#endif + +/* + * 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 float m[16]) +{ + int i; + for (i = 0;i < 4; i++) + g_print ("\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); +} + +/* + * Dumps the contents of a CoglMatrix structure. + */ +void +_cogl_matrix_print (const CoglMatrix *matrix) +{ + if (!(matrix->flags & MAT_DIRTY_TYPE)) + { + _COGL_RETURN_IF_FAIL (matrix->type < COGL_MATRIX_N_TYPES); + g_print ("Matrix type: %s, flags: %x\n", + types[matrix->type], (int)matrix->flags); + } + else + g_print ("Matrix type: DIRTY, flags: %x\n", (int)matrix->flags); + + print_matrix_floats ((float *)matrix); + g_print ("Inverse: \n"); + if (!(matrix->flags & MAT_DIRTY_INVERSE)) + { + float prod[16]; + print_matrix_floats (matrix->inv); + matrix_multiply4x4 (prod, (float *)matrix, matrix->inv); + g_print ("Mat * Inverse:\n"); + print_matrix_floats (prod); + } + else + g_print (" - not available\n"); +} + +/* + * 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 gboolean +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 gboolean +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 gboolean +invert_matrix_3d (CoglMatrix *matrix) +{ + const float *in = (float *)matrix; + float *out = matrix->inv; + + 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 gboolean +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 gboolean +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 gboolean +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 gboolean +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 gboolean (*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 gboolean +_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; +} + +gboolean +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]; + gboolean 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); +} + +/* + * 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); +} + +#if 0 +/* + * Test if the given matrix preserves vector lengths. + */ +static gboolean +_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 gboolean +_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 gboolean +_cogl_matrix_is_general_scale (const CoglMatrix *matrix) +{ + return (matrix->flags & MAT_FLAG_GENERAL_SCALE) ? TRUE : FALSE; +} + +static gboolean +_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); +} + +static void +_cogl_matrix_init_from_quaternion (CoglMatrix *matrix, + 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, + CoglQuaternion *quaternion) +{ + _cogl_matrix_init_from_quaternion (matrix, quaternion); +} + +/* + * 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); +} + +gboolean +cogl_matrix_equal (gconstpointer v1, gconstpointer 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 *)((guint8 *)points_in + i * stride_in); + Point3f *o = (Point3f *)((guint8 *)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 *)((guint8 *)points_in + i * stride_in); + Point4f *o = (Point4f *)((guint8 *)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 *)((guint8 *)points_in + i * stride_in); + Point3f *o = (Point3f *)((guint8 *)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 *)((guint8 *)points_in + i * stride_in); + Point4f *o = (Point4f *)((guint8 *)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 *)((guint8 *)points_in + i * stride_in); + Point4f *o = (Point4f *)((guint8 *)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); + } +} + +gboolean +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); +} diff --git a/cogl/cogl-matrix.h b/cogl/cogl-matrix.h new file mode 100644 index 0000000..cca1823 --- /dev/null +++ b/cogl/cogl-matrix.h @@ -0,0 +1,721 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_MATRIX_H +#define __COGL_MATRIX_H + +#include +#include "cogl-types.h" + +#ifdef COGL_ENABLE_EXPERIMENTAL_API +#include "cogl-quaternion.h" +#endif + +G_BEGIN_DECLS + +/** + * SECTION:cogl-matrix + * @short_description: Fuctions 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_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); + +/** + * 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() + */ +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. + * + * Return value: a pointer to the float array + */ +void +cogl_matrix_init_from_quaternion (CoglMatrix *matrix, + CoglQuaternion *quaternion); +#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 + */ +gboolean +cogl_matrix_equal (gconstpointer v1, gconstpointer 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. + * + * Returns: 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 + */ +gboolean +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; + * guint8 r,g,b,a; + * float s,t,p; + * } MyInVertex; + * typedef struct { + * guint8 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; + * guint8 r,g,b,a; + * float s,t,p; + * } MyInVertex; + * typedef struct { + * guint8 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 + */ +gboolean +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); + +#ifdef _COGL_SUPPORTS_GTYPE_INTEGRATION + +#define COGL_GTYPE_TYPE_MATRIX (cogl_gtype_matrix_get_type ()) + +/** + * 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. + */ +GType +cogl_gtype_matrix_get_type (void); + +#endif /* _COGL_SUPPORTS_GTYPE_INTEGRATION */ + +G_END_DECLS + +#endif /* __COGL_MATRIX_H */ + diff --git a/cogl/cogl-meta-texture.c b/cogl/cogl-meta-texture.c new file mode 100644 index 0000000..f77a6c6 --- /dev/null +++ b/cogl/cogl-meta-texture.c @@ -0,0 +1,636 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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_y_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_y_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; + gboolean s_flipped; + gboolean 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 gboolean +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) + { + gboolean 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..dca9f5e --- /dev/null +++ b/cogl/cogl-meta-texture.h @@ -0,0 +1,181 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_META_TEXTURE_H__ +#define __COGL_META_TEXTURE_H__ + +#include +#include + +G_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_draw_attributes() 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_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_draw_attributes(). + * + * 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. + */ + +typedef struct _CoglMetaTexture CoglMetaTexture; +#define COGL_META_TEXTURE(X) ((CoglMetaTexture *)X) + +/** + * 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_draw_attributes() + * 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); + +G_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..71f1806 --- /dev/null +++ b/cogl/cogl-node-private.h @@ -0,0 +1,85 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_NODE_PRIVATE_H +#define __COGL_NODE_PRIVATE_H + +#include "cogl-object-private.h" +#include "cogl-queue.h" + +typedef struct _CoglNode CoglNode; + +COGL_LIST_HEAD (CoglNodeList, 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 */ + COGL_LIST_ENTRY (CoglNode) list_node; + + /* List of children */ + CoglNodeList children; + + /* TRUE if the node took a strong reference on its parent. Weak + * pipelines for instance don't take a reference on their parent. */ + gboolean 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, + gboolean take_strong_reference); + +void +_cogl_pipeline_node_unparent_real (CoglNode *node); + +typedef gboolean (*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..3d7909e --- /dev/null +++ b/cogl/cogl-node.c @@ -0,0 +1,104 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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, + gboolean 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_HEAD (&parent->children, node, list_node); + + 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, list_node); + + 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_FOREACH_SAFE (child, &node->children, list_node, next) + callback (child, user_data); +} + + diff --git a/cogl/cogl-object-private.h b/cogl/cogl-object-private.h new file mode 100644 index 0000000..be1e709 --- /dev/null +++ b/cogl/cogl-object-private.h @@ -0,0 +1,291 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * 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 +{ + 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; + + 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 (HANDLE, "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 (HANDLE, "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 (HANDLE, "COGL %s UNREF %p %i", \ + (__obj)->klass->name, \ + (__obj), (__obj)->ref_count - 1); } G_STMT_END + +#define COGL_OBJECT_DEBUG_FREE(obj) \ + COGL_NOTE (HANDLE, "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 */ + +/* For temporary compatability */ +#define _COGL_HANDLE_DEBUG_NEW _COGL_OBJECT_DEBUG_NEW +#define _COGL_HANDLE_DEBUG_REF _COGL_OBJECT_DEBUG_REF +#define _COGL_HANDLE_DEBUG_UNREF _COGL_OBJECT_DEBUG_UNREF +#define COGL_HANDLE_DEBUG_FREE COGL_OBJECT_DEBUG_FREE + +#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 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##_count = 0; \ + \ + if (_cogl_debug_instances == NULL) \ + _cogl_debug_instances = \ + g_hash_table_new (g_str_hash, g_str_equal); \ + \ + obj->klass->virt_free = \ + _cogl_object_##type_name##_indirect_free; \ + obj->klass->virt_unref = \ + _cogl_object_default_unref; \ + obj->klass->name = "Cogl"#TypeName, \ + \ + g_hash_table_insert (_cogl_debug_instances, \ + (void *) obj->klass->name, \ + &_cogl_object_##type_name##_count); \ + \ + { code; } \ + } \ + \ + _cogl_object_##type_name##_inc (); \ + _COGL_OBJECT_DEBUG_NEW (TypeName, obj); \ + return new_obj; \ +} + +#define COGL_OBJECT_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code) \ + \ +gboolean \ +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) \ + \ +gboolean \ +_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 (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_INTERNAL_DEFINE(TypeName, type_name) \ + COGL_HANDLE_INTERNAL_DEFINE_WITH_CODE (TypeName, type_name, (void) 0) + +#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..9ae29f7 --- /dev/null +++ b/cogl/cogl-object.c @@ -0,0 +1,295 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * 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" + +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..f948c7f --- /dev/null +++ b/cogl/cogl-object.h @@ -0,0 +1,200 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + */ + +#ifndef __COGL_OBJECT_H +#define __COGL_OBJECT_H + +typedef struct _CoglObject CoglObject; + +#define COGL_OBJECT(X) ((CoglObject *)X) + +/** + * 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 + */ +typedef void (*CoglUserDataDestroyCallback) (void *user_data); + +/** + * 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 + +#define cogl_debug_object_foreach_type \ + cogl_debug_object_foreach_type_EXP + +/** + * cogl_debug_object_foreach_type: + * func: A callback function for each type + * user_data: 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); + +#define cogl_debug_object_print_instances \ + cogl_debug_object_print_instances_EXP + +/** + * 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 */ + +#endif /* __COGL_OBJECT_H */ + diff --git a/cogl/cogl-offscreen.h b/cogl/cogl-offscreen.h new file mode 100644 index 0000000..47298bd --- /dev/null +++ b/cogl/cogl-offscreen.h @@ -0,0 +1,117 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2012 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_OFFSCREEN_H__ +#define __COGL_OFFSCREEN_H__ + +#include +#include + +G_BEGIN_DECLS + +/** + * SECTION:cogl-offscreen + * @short_description: Fuctions for creating and manipulating offscreen + * framebuffers. + * + * Cogl allows creating and operating on offscreen framebuffers. + */ + +typedef struct _CoglOffscreen CoglOffscreen; + +#define COGL_OFFSCREEN(X) ((CoglOffscreen *)X) + +/* Offscreen api */ + +/** + * 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. + */ +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 + */ +gboolean +cogl_is_offscreen (void *object); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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. + */ +void * +cogl_offscreen_ref (void *offscreen) G_GNUC_DEPRECATED; + +/** + * 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. + */ +void +cogl_offscreen_unref (void *offscreen) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +G_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..a1322fd --- /dev/null +++ b/cogl/cogl-onscreen-private.h @@ -0,0 +1,80 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_ONSCREEN_PRIVATE_H +#define __COGL_ONSCREEN_PRIVATE_H + +#include "cogl-framebuffer-private.h" +#include "cogl-queue.h" + +#include + +#ifdef COGL_HAS_WIN32_SUPPORT +#include +#endif + +typedef struct _CoglSwapBuffersNotifyEntry CoglSwapBuffersNotifyEntry; + +COGL_TAILQ_HEAD (CoglSwapBuffersNotifyList, CoglSwapBuffersNotifyEntry); + +struct _CoglSwapBuffersNotifyEntry +{ + COGL_TAILQ_ENTRY (CoglSwapBuffersNotifyEntry) list_node; + + CoglSwapBuffersNotify callback; + void *user_data; + unsigned int id; +}; + +struct _CoglOnscreen +{ + CoglFramebuffer _parent; + +#ifdef COGL_HAS_X11_SUPPORT + guint32 foreign_xid; + CoglOnscreenX11MaskCallback foreign_update_mask_callback; + void *foreign_update_mask_data; +#endif + +#ifdef COGL_HAS_WIN32_SUPPORT + HWND foreign_hwnd; +#endif + + gboolean swap_throttled; + + CoglSwapBuffersNotifyList swap_callbacks; + + void *winsys; +}; + +CoglOnscreen * +_cogl_onscreen_new (void); + +void +_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer, + int width, int height); + +void +_cogl_onscreen_notify_swap_buffers (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..b080b57 --- /dev/null +++ b/cogl/cogl-onscreen-template-private.h @@ -0,0 +1,38 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..6aa1d10 --- /dev/null +++ b/cogl/cogl-onscreen-template.c @@ -0,0 +1,89 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * 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 + +static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template); + +COGL_OBJECT_DEFINE (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.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, + gboolean 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..64d9b74 --- /dev/null +++ b/cogl/cogl-onscreen-template.h @@ -0,0 +1,107 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_ONSCREEN_TEMPLATE_H__ +#define __COGL_ONSCREEN_TEMPLATE_H__ + +#include + +G_BEGIN_DECLS + +typedef struct _CoglOnscreenTemplate CoglOnscreenTemplate; + +#define COGL_ONSCREEN_TEMPLATE(OBJECT) ((CoglOnscreenTemplate *)OBJECT) + +#define cogl_onscreen_template_new cogl_onscreen_template_new_EXP +CoglOnscreenTemplate * +cogl_onscreen_template_new (CoglSwapChain *swap_chain); + +/** + * cogl_onscreen_template_set_samples_per_pixel: + * @onscreen: 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, + gboolean 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 + */ +gboolean +cogl_is_onscreen_template (void *object); + +G_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..9a1d583 --- /dev/null +++ b/cogl/cogl-onscreen.c @@ -0,0 +1,366 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-onscreen-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" + +static void _cogl_onscreen_free (CoglOnscreen *onscreen); + +COGL_OBJECT_DEFINE_WITH_CODE (Onscreen, onscreen, + _cogl_onscreen_class.virt_unref = + _cogl_framebuffer_unref); + +static void +_cogl_onscreen_init_from_template (CoglOnscreen *onscreen, + CoglOnscreenTemplate *onscreen_template) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + COGL_TAILQ_INIT (&onscreen->swap_callbacks); + + 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, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 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, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 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); + + if (framebuffer->context->window_buffer == 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); +} + +void +cogl_onscreen_swap_buffers (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys; + + _COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); + + /* FIXME: we shouldn't need to flush *all* journals here! */ + cogl_flush (); + winsys = _cogl_framebuffer_get_winsys (framebuffer); + winsys->onscreen_swap_buffers (COGL_ONSCREEN (framebuffer)); + cogl_framebuffer_discard_buffers (framebuffer, + COGL_BUFFER_BIT_COLOR | + COGL_BUFFER_BIT_DEPTH | + COGL_BUFFER_BIT_STENCIL); +} + +void +cogl_onscreen_swap_region (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys; + + _COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); + + /* 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); +} + +#ifdef COGL_HAS_X11_SUPPORT +void +cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen, + guint32 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; +} + +guint32 +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); + } +} + +guint32 +cogl_x11_onscreen_get_visual_xid (CoglOnscreen *onscreen) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); + XVisualInfo *visinfo; + guint32 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 = (guint32)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 */ + +unsigned int +cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen, + CoglSwapBuffersNotify callback, + void *user_data) +{ + CoglSwapBuffersNotifyEntry *entry = g_slice_new0 (CoglSwapBuffersNotifyEntry); + static int next_swap_buffers_callback_id = 0; + + entry->callback = callback; + entry->user_data = user_data; + entry->id = next_swap_buffers_callback_id++; + + COGL_TAILQ_INSERT_TAIL (&onscreen->swap_callbacks, entry, list_node); + + return entry->id; +} + +void +cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen, + unsigned int id) +{ + CoglSwapBuffersNotifyEntry *entry; + + COGL_TAILQ_FOREACH (entry, &onscreen->swap_callbacks, list_node) + { + if (entry->id == id) + { + COGL_TAILQ_REMOVE (&onscreen->swap_callbacks, entry, list_node); + g_slice_free (CoglSwapBuffersNotifyEntry, entry); + break; + } + } +} + +void +cogl_onscreen_set_swap_throttled (CoglOnscreen *onscreen, + gboolean 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_swap_buffers (CoglOnscreen *onscreen) +{ + CoglSwapBuffersNotifyEntry *entry, *tmp; + + COGL_TAILQ_FOREACH_SAFE (entry, + &onscreen->swap_callbacks, + list_node, + tmp) + entry->callback (COGL_FRAMEBUFFER (onscreen), entry->user_data); +} + +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; + + /* The framebuffer geometry can affect the GL viewport so if the + * framebuffer being updated is the current framebuffer we mark the + * viewport state as changed so it will be updated the next time + * _cogl_framebuffer_flush_state() is called. */ + if (framebuffer->context->current_draw_buffer == framebuffer) + framebuffer->context->current_draw_buffer_changes |= + COGL_FRAMEBUFFER_STATE_VIEWPORT; +} diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h new file mode 100644 index 0000000..9d150b2 --- /dev/null +++ b/cogl/cogl-onscreen.h @@ -0,0 +1,399 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011,2012 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_ONSCREEN_H +#define __COGL_ONSCREEN_H + +#include +#include +#include + +G_BEGIN_DECLS + +typedef struct _CoglOnscreen CoglOnscreen; +#define COGL_ONSCREEN(X) ((CoglOnscreen *)(X)) + +/** + * cogl_onscreen_new: + * @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: 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, + guint32 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. + * + * 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, + * guint32 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, + guint32 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 + */ +guint32 +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. */ +guint32 +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_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 x offset for the new framebuffer + * + * Queues a resize of the given @onscreen framebuffer which will be applied + * during the next swap buffers request. 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. + * + * If cogl_wayland_onscreen_resize() is called multiple times 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 #CoglOncsreen framebuffer + * @throttled: Whether swap throttling is wanted or not. + * + * Requests that the given @onscreen framebuffer should have swap buffer + * requests (made using cogl_framebuffer_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, + gboolean 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. + * + * 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. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_onscreen_swap_buffers (CoglOnscreen *onscreen); + +/** + * 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_onscreen_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); + + +typedef void (*CoglSwapBuffersNotify) (CoglFramebuffer *framebuffer, + void *user_data); + +/** + * cogl_onscreen_add_swap_buffers_callback: + * @onscreen: A #CoglOnscreen framebuffer + * @callback: A callback function to call when a swap has completed + * @user_data: 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 + */ +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 + */ +void +cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen, + unsigned int id); + +/** + * 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 + */ +gboolean +cogl_is_onscreen (void *object); + +G_END_DECLS + +#endif /* __COGL_ONSCREEN_H */ diff --git a/cogl/cogl-pango.h b/cogl/cogl-pango.h new file mode 100644 index 0000000..703b5db --- /dev/null +++ b/cogl/cogl-pango.h @@ -0,0 +1,33 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ +#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-path-functions.h b/cogl/cogl-path-functions.h new file mode 100644 index 0000000..2566fe1 --- /dev/null +++ b/cogl/cogl-path-functions.h @@ -0,0 +1,430 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2012 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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 + +G_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 + */ +gboolean +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); + +G_END_DECLS + +#endif /* __COGL_PATH_FUNCTIONS_H__ */ + diff --git a/cogl/cogl-path-private.h b/cogl/cogl-path-private.h new file mode 100644 index 0000000..fd2e1de --- /dev/null +++ b/cogl/cogl-path-private.h @@ -0,0 +1,119 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#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; + + 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]; + + 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 */ + gboolean is_rectangle; +}; + +void +_cogl_add_path_to_stencil_buffer (CoglPath *path, + gboolean merge, + gboolean need_clear); + +void +_cogl_path_get_bounds (CoglPath *path, + float *min_x, + float *min_y, + float *max_x, + float *max_y); + +gboolean +_cogl_path_is_rectangle (CoglPath *path); + +void +_cogl_path_fill_nodes (CoglPath *path, CoglDrawFlags flags); + +#endif /* __COGL_PATH_PRIVATE_H */ diff --git a/cogl/cogl-path.c b/cogl/cogl-path.c new file mode 100644 index 0000000..aab3dfb --- /dev/null +++ b/cogl/cogl-path.c @@ -0,0 +1,306 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl2-path.h" + +#include +#include + +#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 + +#include "cogl-path-functions.h" + +void +cogl_path_set_fill_rule (CoglPathFillRule fill_rule) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_set_fill_rule (ctx->current_path, 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 (ctx->current_path); +} + +void +cogl_path_fill (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_fill (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 (ctx->current_path); +} + +void +cogl_path_stroke (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_stroke (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 (ctx->current_path); +} + +void +cogl_path_move_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_move_to (ctx->current_path, x, y); +} + +void +cogl_path_rel_move_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_rel_move_to (ctx->current_path, x, y); +} + +void +cogl_path_line_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_line_to (ctx->current_path, x, y); +} + +void +cogl_path_rel_line_to (float x, + float y) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_rel_line_to (ctx->current_path, x, y); +} + +void +cogl_path_close (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_close (ctx->current_path); +} + +void +cogl_path_new (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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 (ctx->current_path, 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 (ctx->current_path, coords, num_points); +} + +void +cogl_path_polygon (const float *coords, + int num_points) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + cogl2_path_polygon (ctx->current_path, 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 (ctx->current_path, 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 (ctx->current_path, + 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 (ctx->current_path, + 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 (ctx->current_path, + 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 (ctx->current_path, + 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 (ctx->current_path, + x_1, y_1, x_2, y_2, x_3, y_3); +} + +CoglPath * +cogl_get_path (void) +{ + _COGL_GET_CONTEXT (ctx, NULL); + + return ctx->current_path; +} + +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); + cogl_object_unref (ctx->current_path); + ctx->current_path = path; +} + diff --git a/cogl/cogl-path.h b/cogl/cogl-path.h new file mode 100644 index 0000000..c3d0d45 --- /dev/null +++ b/cogl/cogl-path.h @@ -0,0 +1,105 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PATH_H__ +#define __COGL_PATH_H__ + +#include + +G_BEGIN_DECLS + +/** + * 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. + */ + +typedef struct _CoglPath CoglPath; + +#define COGL_PATH(obj) ((CoglPath *)(obj)) + +/** + * 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 is %COGL_PATH_FILL_RULE_EVEN_ODD. The fill + * rule is attached to the current path so preserving a path with + * cogl_get_path() also preserves the fill rule. Calling + * cogl_path_new() resets the current fill rule to the default. + * + *
+ * 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; + +G_END_DECLS + +#include "cogl-path-functions.h" + +#endif /* __COGL_PATH_H__ */ + diff --git a/cogl/cogl-pipeline-cache.c b/cogl/cogl-pipeline-cache.c new file mode 100644 index 0000000..5df18ce --- /dev/null +++ b/cogl/cogl-pipeline-cache.c @@ -0,0 +1,282 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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-cache.h" + +struct _CoglPipelineCache +{ + GHashTable *fragment_hash; + GHashTable *vertex_hash; + GHashTable *combined_hash; +}; + +static unsigned int +pipeline_fragment_hash (const void *data) +{ + unsigned int fragment_state; + unsigned int layer_fragment_state; + + _COGL_GET_CONTEXT (ctx, 0); + + fragment_state = + _cogl_pipeline_get_state_for_fragment_codegen (ctx); + layer_fragment_state = + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx); + + return _cogl_pipeline_hash ((CoglPipeline *)data, + fragment_state, layer_fragment_state, + 0); +} + +static gboolean +pipeline_fragment_equal (const void *a, const void *b) +{ + unsigned int fragment_state; + unsigned int layer_fragment_state; + + _COGL_GET_CONTEXT (ctx, 0); + + fragment_state = + _cogl_pipeline_get_state_for_fragment_codegen (ctx); + layer_fragment_state = + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx); + + return _cogl_pipeline_equal ((CoglPipeline *)a, (CoglPipeline *)b, + fragment_state, layer_fragment_state, + 0); +} + +static unsigned int +pipeline_vertex_hash (const void *data) +{ + unsigned long vertex_state = + COGL_PIPELINE_STATE_AFFECTS_VERTEX_CODEGEN; + unsigned long layer_vertex_state = + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN; + + return _cogl_pipeline_hash ((CoglPipeline *)data, + vertex_state, layer_vertex_state, + 0); +} + +static gboolean +pipeline_vertex_equal (const void *a, const void *b) +{ + unsigned long vertex_state = + COGL_PIPELINE_STATE_AFFECTS_VERTEX_CODEGEN; + unsigned long layer_vertex_state = + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN; + + return _cogl_pipeline_equal ((CoglPipeline *)a, (CoglPipeline *)b, + vertex_state, layer_vertex_state, + 0); +} + +static unsigned int +pipeline_combined_hash (const void *data) +{ + unsigned int combined_state; + unsigned int layer_combined_state; + + _COGL_GET_CONTEXT (ctx, 0); + + combined_state = + _cogl_pipeline_get_state_for_fragment_codegen (ctx) | + COGL_PIPELINE_STATE_AFFECTS_VERTEX_CODEGEN; + layer_combined_state = + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx) | + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN; + + return _cogl_pipeline_hash ((CoglPipeline *)data, + combined_state, layer_combined_state, + 0); +} + +static gboolean +pipeline_combined_equal (const void *a, const void *b) +{ + unsigned int combined_state; + unsigned int layer_combined_state; + + _COGL_GET_CONTEXT (ctx, 0); + + combined_state = + _cogl_pipeline_get_state_for_fragment_codegen (ctx) | + COGL_PIPELINE_STATE_AFFECTS_VERTEX_CODEGEN; + layer_combined_state = + _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx) | + COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN; + + return _cogl_pipeline_equal ((CoglPipeline *)a, (CoglPipeline *)b, + combined_state, layer_combined_state, + 0); +} + +CoglPipelineCache * +cogl_pipeline_cache_new (void) +{ + CoglPipelineCache *cache = g_new (CoglPipelineCache, 1); + + cache->fragment_hash = g_hash_table_new_full (pipeline_fragment_hash, + pipeline_fragment_equal, + cogl_object_unref, + cogl_object_unref); + cache->vertex_hash = g_hash_table_new_full (pipeline_vertex_hash, + pipeline_vertex_equal, + cogl_object_unref, + cogl_object_unref); + cache->combined_hash = g_hash_table_new_full (pipeline_combined_hash, + pipeline_combined_equal, + cogl_object_unref, + cogl_object_unref); + + return cache; +} + +void +cogl_pipeline_cache_free (CoglPipelineCache *cache) +{ + g_hash_table_destroy (cache->fragment_hash); + g_hash_table_destroy (cache->vertex_hash); + g_hash_table_destroy (cache->combined_hash); + g_free (cache); +} + +CoglPipeline * +_cogl_pipeline_cache_get_fragment_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline) +{ + CoglPipeline *template = + g_hash_table_lookup (cache->fragment_hash, key_pipeline); + + if (template == NULL) + { + /* XXX: I wish there was a way to insert into a GHashTable with + * a pre-calculated hash value since there is a cost to + * calculating the hash of a CoglPipeline and in this case we + * know we have already called _cogl_pipeline_hash during the + * lookup so we could pass the value through to here to avoid + * hashing it again. + */ + + /* XXX: Any keys referenced by the hash table need to remain + * valid all the while that there are corresponding values, + * so for now we simply make a copy of the current authority + * pipeline. + * + * FIXME: A problem with this is that our key into the cache may + * hold references to some arbitrary user textures which will + * now be kept alive indefinitly which is a shame. A better + * solution will be to derive a special "key pipeline" from the + * authority which derives from the base Cogl pipeline (to avoid + * affecting the lifetime of any other pipelines) and only takes + * a copy of the state that relates to the fragment shader and + * references small dummy textures instead of potentially large + * user textures. */ + template = cogl_pipeline_copy (key_pipeline); + + g_hash_table_insert (cache->fragment_hash, + template, + cogl_object_ref (template)); + + if (G_UNLIKELY (g_hash_table_size (cache->fragment_hash) > 50)) + { + static gboolean seen = FALSE; + if (!seen) + g_warning ("Over 50 separate fragment shaders have been " + "generated which is very unusual, so something " + "is probably wrong!\n"); + seen = TRUE; + } + } + + return template; +} + +CoglPipeline * +_cogl_pipeline_cache_get_vertex_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline) +{ + CoglPipeline *template = + g_hash_table_lookup (cache->vertex_hash, key_pipeline); + + if (template == NULL) + { + template = cogl_pipeline_copy (key_pipeline); + + g_hash_table_insert (cache->vertex_hash, + template, + cogl_object_ref (template)); + + if (G_UNLIKELY (g_hash_table_size (cache->vertex_hash) > 50)) + { + static gboolean seen = FALSE; + if (!seen) + g_warning ("Over 50 separate vertex shaders have been " + "generated which is very unusual, so something " + "is probably wrong!\n"); + seen = TRUE; + } + } + + return template; +} + +CoglPipeline * +_cogl_pipeline_cache_get_combined_template (CoglPipelineCache *cache, + CoglPipeline *key_pipeline) +{ + CoglPipeline *template = + g_hash_table_lookup (cache->combined_hash, key_pipeline); + + if (template == NULL) + { + template = cogl_pipeline_copy (key_pipeline); + + g_hash_table_insert (cache->combined_hash, + template, + cogl_object_ref (template)); + + if (G_UNLIKELY (g_hash_table_size (cache->combined_hash) > 50)) + { + static gboolean seen = FALSE; + if (!seen) + g_warning ("Over 50 separate programs have been " + "generated which is very unusual, so something " + "is probably wrong!\n"); + seen = TRUE; + } + } + + return template; +} diff --git a/cogl/cogl-pipeline-cache.h b/cogl/cogl-pipeline-cache.h new file mode 100644 index 0000000..c9a5d6a --- /dev/null +++ b/cogl/cogl-pipeline-cache.h @@ -0,0 +1,77 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_PIPELINE_CACHE_H__ +#define __COGL_PIPELINE_CACHE_H__ + +#include "cogl-pipeline.h" + +typedef struct _CoglPipelineCache CoglPipelineCache; + +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 + */ +CoglPipeline * +_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 + */ +CoglPipeline * +_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 + */ +CoglPipeline * +_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..00d03c6 --- /dev/null +++ b/cogl/cogl-pipeline-debug.c @@ -0,0 +1,290 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010,2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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 gboolean +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; + gboolean 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 gboolean +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 gboolean +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; + gboolean changes = FALSE; + gboolean 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 ? + pipeline->static_breadcrumb : "NULL"); + + 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-fragend-arbfp-private.h b/cogl/cogl-pipeline-fragend-arbfp-private.h new file mode 100644 index 0000000..06c625c --- /dev/null +++ b/cogl/cogl-pipeline-fragend-arbfp-private.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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/cogl-pipeline-fragend-arbfp.c b/cogl/cogl-pipeline-fragend-arbfp.c new file mode 100644 index 0000000..2b58063 --- /dev/null +++ b/cogl/cogl-pipeline-fragend-arbfp.c @@ -0,0 +1,1002 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-context-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-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.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; +} CoglPipelineShaderState; + +static CoglUserDataKey shader_state_key; + +static CoglPipelineShaderState * +shader_state_new (int n_layers) +{ + CoglPipelineShaderState *shader_state; + + shader_state = g_slice_new0 (CoglPipelineShaderState); + shader_state->ref_count = 1; + shader_state->unit_state = g_new0 (UnitState, n_layers); + + 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->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) +{ + _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 gboolean +_cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference, + int n_tex_coord_attribs) +{ + CoglPipelineShaderState *shader_state; + CoglPipeline *authority; + CoglPipeline *template_pipeline = NULL; + CoglHandle user_program; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* First validate that we can handle the current state using ARBfp + */ + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP)) + return FALSE; + + /* TODO: support fog */ + if (_cogl_pipeline_get_fog_enabled (pipeline)) + 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_INVALID_HANDLE) + { + /* If the program doesn't have a fragment shader then some other + vertend will handle the vertex shader state and we still need + to generate a fragment program */ + if (!_cogl_program_has_fragment_shader (user_program)) + user_program = COGL_INVALID_HANDLE; + /* If the user program does have a fragment shader then we can + only handle it if it's in ARBfp */ + else if (_cogl_program_get_language (user_program) != + COGL_SHADER_LANGUAGE_ARBFP) + return FALSE; + } + + /* 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 TRUE; + + /* 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... */ + shader_state->ref_count++; + set_shader_state (pipeline, shader_state); + return TRUE; + } + + /* 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)))) + { + template_pipeline = + _cogl_pipeline_cache_get_fragment_template (ctx->pipeline_cache, + authority); + + shader_state = get_shader_state (template_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); + + 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); + + /* 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) + { + shader_state->ref_count++; + 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 (template_pipeline) + { + shader_state->ref_count++; + set_shader_state (template_pipeline, shader_state); + } + + return TRUE; +} + +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 gboolean 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 gboolean +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 gboolean +_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 gboolean +_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; + gboolean update_all; + CoglPipelineShaderState *shader_state; +} UpdateConstantsState; + +static gboolean +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 gboolean +_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; + gboolean 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/cogl-pipeline-fragend-fixed-private.h b/cogl/cogl-pipeline-fragend-fixed-private.h new file mode 100644 index 0000000..79aaf83 --- /dev/null +++ b/cogl/cogl-pipeline-fragend-fixed-private.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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/cogl-pipeline-fragend-fixed.c b/cogl/cogl-pipeline-fragend-fixed.c new file mode 100644 index 0000000..c8e8e2c --- /dev/null +++ b/cogl/cogl-pipeline-fragend-fixed.c @@ -0,0 +1,451 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-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-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.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 gboolean +_cogl_pipeline_fragend_fixed_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference, + int n_tex_coord_attribs) +{ + CoglHandle user_program; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED))) + return FALSE; + + if (ctx->driver == COGL_DRIVER_GLES2) + 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 with a fragment shader then the + appropriate backend for that language should handle it. We can + still use the fixed fragment backend if the program only contains + a vertex shader */ + user_program = cogl_pipeline_get_user_program (pipeline); + if (user_program != COGL_INVALID_HANDLE && + _cogl_program_has_fragment_shader (user_program)) + return FALSE; + + _cogl_use_fragment_program (0, COGL_PIPELINE_PROGRAM_TYPE_FIXED); + return TRUE; +} + +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 gboolean 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 gboolean +_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 gboolean +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 gboolean +_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/cogl-pipeline-fragend-glsl-private.h b/cogl/cogl-pipeline-fragend-glsl-private.h new file mode 100644 index 0000000..3542d6c --- /dev/null +++ b/cogl/cogl-pipeline-fragend-glsl-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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/cogl-pipeline-fragend-glsl.c b/cogl/cogl-pipeline-fragend-glsl.c new file mode 100644 index 0000000..1f44722 --- /dev/null +++ b/cogl/cogl-pipeline-fragend-glsl.c @@ -0,0 +1,1170 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-layer-private.h" +#include "cogl-shader-private.h" +#include "cogl-blend-string.h" +#include "cogl-snippet-private.h" + +#ifdef COGL_PIPELINE_FRAGEND_GLSL + +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.h" +#include "cogl-shader-private.h" +#include "cogl-program-private.h" +#include "cogl-pipeline-cache.h" +#include "cogl-pipeline-fragend-glsl-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 LayerData; + +COGL_LIST_HEAD (LayerDataList, LayerData); + +struct _LayerData +{ + COGL_LIST_ENTRY (LayerData) list_node; + + /* 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; +}; + +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 */ + LayerDataList layers; + + /* Age of the user program that was current when the shader was + generated. We need to keep track of this because if the user + program changes then we may need to redecide whether to generate + a shader at all */ + unsigned int user_program_age; + + /* The number of tex coord attributes that the shader was generated + for. If this changes on GLES2 then we need to regenerate the + shader */ + int n_tex_coord_attribs; +} CoglPipelineShaderState; + +static CoglUserDataKey shader_state_key; + +static void +ensure_layer_generated (CoglPipeline *pipeline, + int layer_num); + +static CoglPipelineShaderState * +shader_state_new (int n_layers) +{ + CoglPipelineShaderState *shader_state; + + shader_state = g_slice_new0 (CoglPipelineShaderState); + shader_state->ref_count = 1; + shader_state->unit_state = g_new0 (UnitState, n_layers); + + 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) +{ + CoglPipelineShaderState *shader_state = user_data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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) +{ + 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 gboolean +has_replace_hook (CoglPipelineLayer *layer, + CoglSnippetHook hook) +{ + CoglPipelineSnippet *snippet; + + COGL_LIST_FOREACH (snippet, get_layer_fragment_snippets (layer), list_node) + if (snippet->snippet->hook == hook && snippet->snippet->replace) + return TRUE; + + return FALSE; +} + +static gboolean +_cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference, + int n_tex_coord_attribs) +{ + CoglPipelineShaderState *shader_state; + CoglPipeline *authority; + CoglPipeline *template_pipeline = NULL; + CoglProgram *user_program; + int i; + + _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 the user fragment shader isn't GLSL then we should let + another backend handle it */ + if (user_program && + _cogl_program_has_fragment_shader (user_program) && + _cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_GLSL) + return FALSE; + + /* 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)))) + { + template_pipeline = + _cogl_pipeline_cache_get_fragment_template (ctx->pipeline_cache, + authority); + + shader_state = get_shader_state (template_pipeline); + } + + if (shader_state) + shader_state->ref_count++; + else + shader_state = shader_state_new (n_layers); + + set_shader_state (authority, shader_state); + + if (template_pipeline) + { + shader_state->ref_count++; + set_shader_state (template_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) + { + shader_state->ref_count++; + set_shader_state (pipeline, shader_state); + } + } + + if (shader_state->gl_shader) + { + /* If we already have a valid GLSL shader then we don't need to + generate a new one. However if there's a user program and it + has changed since the last link then we do need a new + shader. If the number of tex coord attribs changes on GLES2 + then we need to regenerate the shader with a different boiler + plate */ + if ((user_program == NULL || + shader_state->user_program_age == user_program->age) + && (ctx->driver != COGL_DRIVER_GLES2 || + shader_state->n_tex_coord_attribs == n_tex_coord_attribs)) + return TRUE; + + /* We need to recreate the shader so destroy the existing one */ + GE( ctx, glDeleteShader (shader_state->gl_shader) ); + shader_state->gl_shader = 0; + } + + /* 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 */ + + if (user_program) + shader_state->user_program_age = user_program->age; + + shader_state->n_tex_coord_attribs = n_tex_coord_attribs; + + /* If the user program contains a fragment shader then we don't need + to generate one */ + if (user_program && + _cogl_program_has_fragment_shader (user_program)) + return TRUE; + + /* 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); + + 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; + } + + return TRUE; +} + +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 +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; +} + +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); + 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 point sprite coord generation is being used then divert to the + built-in varying var for that instead of the texture + coordinates. We don't want to do this under GL because in that + case we will instead use glTexEnv(GL_COORD_REPLACE) to replace + the texture coords with the point sprite coords. Although GL also + supports the gl_PointCoord variable, it requires GLSL 1.2 which + would mean we would have to declare the GLSL version and check + for it */ + if (ctx->driver == COGL_DRIVER_GLES2 && + cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline, + layer->index)) + g_string_append_printf (shader_state->source, + "gl_PointCoord"); + else + g_string_append_printf (shader_state->source, + "cogl_tex_coord_in[%d]", + unit_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 gboolean 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_FOREACH (layer_data, &shader_state->layers, list_node) + { + 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, list_node); + + 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 gboolean +_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 + layer_data->previous_layer_index + = COGL_LIST_FIRST (&shader_state->layers)->layer->index; + + COGL_LIST_INSERT_HEAD (&shader_state->layers, layer_data, list_node); + + return TRUE; +} + +/* GLES2 doesn't have alpha testing so we need to implement it in the + shader */ + +#ifdef HAVE_COGL_GLES2 + +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 gboolean +_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; + + /* We always emit sampler uniforms in case there will be custom + * layer snippets that want to sample arbitrary layers. */ + + COGL_LIST_FOREACH (layer_data, &shader_state->layers, list_node) + { + CoglPipelineLayer *layer = layer_data->layer; + CoglTextureType texture_type = + _cogl_pipeline_layer_get_texture_type (layer); + const char *target_string; + + 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); + } + + last_layer = COGL_LIST_FIRST (&shader_state->layers)->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_FOREACH_SAFE (layer_data, &shader_state->layers, + list_node, tmp) + g_slice_free (LayerData, layer_data); + } + else + g_string_append (shader_state->source, + " cogl_color_out = cogl_color_in;\n"); + +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + 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_shader_set_source_with_boilerplate (shader, GL_FRAGMENT_SHADER, + shader_state + ->n_tex_coord_attribs, + 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/cogl-pipeline-layer-private.h b/cogl/cogl-pipeline-layer-private.h new file mode 100644 index 0000000..4446224 --- /dev/null +++ b/cogl/cogl-pipeline-layer-private.h @@ -0,0 +1,408 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010,2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_LAYER_PRIVATE_H +#define __COGL_PIPELINE_LAYER_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-internal.h" +#include "cogl-pipeline-snippet-private.h" + +#include + +/* This isn'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 + +typedef struct _CoglPipelineLayer CoglPipelineLayer; +#define COGL_PIPELINE_LAYER(OBJECT) ((CoglPipelineLayer *)OBJECT) + +/* 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 _CoglPipelineWrapModeInternal +{ + COGL_PIPELINE_WRAP_MODE_INTERNAL_REPEAT = GL_REPEAT, + COGL_PIPELINE_WRAP_MODE_INTERNAL_MIRRORED_REPEAT = GL_MIRRORED_REPEAT, + COGL_PIPELINE_WRAP_MODE_INTERNAL_CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, + COGL_PIPELINE_WRAP_MODE_INTERNAL_CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER, + COGL_PIPELINE_WRAP_MODE_INTERNAL_AUTOMATIC = GL_ALWAYS +} CoglPipelineWrapModeInternal; + +/* 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_FILTERS_INDEX, + COGL_PIPELINE_LAYER_STATE_WRAP_MODES_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; + + gboolean point_sprite_coords; + + CoglPipelineSnippetList vertex_snippets; + CoglPipelineSnippetList fragment_snippets; +} 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 long 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 texture for this layer, or NULL for an empty + * layer */ + CoglTexture *texture; + /* 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; + + CoglPipelineFilter mag_filter; + CoglPipelineFilter min_filter; + + CoglPipelineWrapModeInternal wrap_mode_s; + CoglPipelineWrapModeInternal wrap_mode_t; + CoglPipelineWrapModeInternal wrap_mode_p; + + /* 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 gboolean +(*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); + +gboolean +_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); + +gboolean +_cogl_pipeline_layer_has_alpha (CoglPipelineLayer *layer); + +gboolean +_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, + CoglPipelineWrapModeInternal *wrap_mode_s, + CoglPipelineWrapModeInternal *wrap_mode_t, + CoglPipelineWrapModeInternal *wrap_mode_r); + +void +_cogl_pipeline_layer_get_filters (CoglPipelineLayer *layer, + CoglPipelineFilter *min_filter, + CoglPipelineFilter *mag_filter); + +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); + +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); + +gboolean +_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..992e889 --- /dev/null +++ b/cogl/cogl-pipeline-layer-state-private.h @@ -0,0 +1,144 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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); + +gboolean +_cogl_pipeline_layer_texture_type_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1, + CoglPipelineEvalFlags flags); + +gboolean +_cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1, + CoglPipelineEvalFlags flags); + +gboolean +_cogl_pipeline_layer_combine_state_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +gboolean +_cogl_pipeline_layer_combine_constant_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +gboolean +_cogl_pipeline_layer_filters_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +gboolean +_cogl_pipeline_layer_wrap_modes_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +gboolean +_cogl_pipeline_layer_user_matrix_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +gboolean +_cogl_pipeline_layer_point_sprite_coords_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +gboolean +_cogl_pipeline_layer_vertex_snippets_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1); + +gboolean +_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_filters_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state); + +void +_cogl_pipeline_layer_hash_wrap_modes_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..785d1e4 --- /dev/null +++ b/cogl/cogl-pipeline-layer-state.c @@ -0,0 +1,1844 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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 "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: + + _cogl_pipeline_update_blend_enable (pipeline, COGL_PIPELINE_STATE_LAYERS); +} + +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: + + _cogl_pipeline_update_blend_enable (pipeline, COGL_PIPELINE_STATE_LAYERS); +} + +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_wrap_modes (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + CoglPipelineLayer *authority, + CoglPipelineWrapModeInternal wrap_mode_s, + CoglPipelineWrapModeInternal wrap_mode_t, + CoglPipelineWrapModeInternal wrap_mode_p) +{ + CoglPipelineLayer *new; + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES; + + if (authority->wrap_mode_s == wrap_mode_s && + authority->wrap_mode_t == wrap_mode_t && + authority->wrap_mode_p == wrap_mode_p) + 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->wrap_mode_s == wrap_mode_s && + old_authority->wrap_mode_t == wrap_mode_t && + old_authority->wrap_mode_p == wrap_mode_p) + { + layer->differences &= ~change; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + return; + } + } + } + + layer->wrap_mode_s = wrap_mode_s; + layer->wrap_mode_t = wrap_mode_t; + layer->wrap_mode_p = wrap_mode_p; + + /* 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 CoglPipelineWrapModeInternal +public_to_internal_wrap_mode (CoglPipelineWrapMode mode) +{ + return (CoglPipelineWrapModeInternal)mode; +} + +static CoglPipelineWrapMode +internal_to_public_wrap_mode (CoglPipelineWrapModeInternal internal_mode) +{ + _COGL_RETURN_VAL_IF_FAIL (internal_mode != + COGL_PIPELINE_WRAP_MODE_INTERNAL_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_WRAP_MODES; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineWrapModeInternal internal_mode = + public_to_internal_wrap_mode (mode); + + _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); + + _cogl_pipeline_set_layer_wrap_modes (pipeline, layer, authority, + internal_mode, + authority->wrap_mode_t, + authority->wrap_mode_p); +} + +void +cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineWrapModeInternal internal_mode = + public_to_internal_wrap_mode (mode); + + _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); + + _cogl_pipeline_set_layer_wrap_modes (pipeline, layer, authority, + authority->wrap_mode_s, + internal_mode, + authority->wrap_mode_p); +} + +/* 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_WRAP_MODES; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineWrapModeInternal internal_mode = + public_to_internal_wrap_mode (mode); + + _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); + + _cogl_pipeline_set_layer_wrap_modes (pipeline, layer, authority, + authority->wrap_mode_s, + authority->wrap_mode_t, + internal_mode); +} + +void +cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline, + int layer_index, + CoglPipelineWrapMode mode) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES; + CoglPipelineLayer *layer; + CoglPipelineLayer *authority; + CoglPipelineWrapModeInternal internal_mode = + public_to_internal_wrap_mode (mode); + + _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); + + _cogl_pipeline_set_layer_wrap_modes (pipeline, layer, authority, + internal_mode, + internal_mode, + internal_mode); + /* XXX: I wonder if we should really be duplicating the mode into + * the 'r' wrap mode too? */ +} + +/* FIXME: deprecate this API */ +CoglPipelineWrapMode +_cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer) +{ + CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES; + CoglPipelineLayer *authority; + + _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); + + return internal_to_public_wrap_mode (authority->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_WRAP_MODES; + CoglPipelineLayer *authority; + + _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); + + return internal_to_public_wrap_mode (authority->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_WRAP_MODES; + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, change); + + return internal_to_public_wrap_mode (authority->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, + CoglPipelineWrapModeInternal *wrap_mode_s, + CoglPipelineWrapModeInternal *wrap_mode_t, + CoglPipelineWrapModeInternal *wrap_mode_p) +{ + CoglPipelineLayer *authority = + _cogl_pipeline_layer_get_authority (layer, + COGL_PIPELINE_LAYER_STATE_WRAP_MODES); + + *wrap_mode_s = authority->wrap_mode_s; + *wrap_mode_t = authority->wrap_mode_t; + *wrap_mode_p = authority->wrap_mode_p; +} + +gboolean +cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, + int layer_index, + gboolean enable, + GError **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) + { + g_set_error (error, COGL_ERROR, COGL_ERROR_UNSUPPORTED, + "Point sprite texture coordinates are enabled " + "for a layer but the GL driver does not support it."); + } + else + { + static gboolean 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; +} + +gboolean +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); +} + +gboolean +_cogl_pipeline_layer_texture_type_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1, + CoglPipelineEvalFlags flags) +{ + return authority0->texture_type == authority1->texture_type; +} + +gboolean +_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; + } +} + +gboolean +_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; +} + +gboolean +_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; +} + +gboolean +_cogl_pipeline_layer_filters_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + if (authority0->mag_filter != authority1->mag_filter) + return FALSE; + if (authority0->min_filter != authority1->min_filter) + return FALSE; + + return TRUE; +} + +static gboolean +compare_wrap_mode_equal (CoglPipelineWrapMode wrap_mode0, + CoglPipelineWrapMode wrap_mode1) +{ + /* We consider AUTOMATIC to be equivalent to CLAMP_TO_EDGE because + the primitives code is expected to override this to something + else if it wants it to be behave any other way */ + if (wrap_mode0 == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + wrap_mode0 = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE; + if (wrap_mode1 == COGL_PIPELINE_WRAP_MODE_AUTOMATIC) + wrap_mode1 = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE; + + return wrap_mode0 == wrap_mode1; +} + +gboolean +_cogl_pipeline_layer_wrap_modes_equal (CoglPipelineLayer *authority0, + CoglPipelineLayer *authority1) +{ + if (!compare_wrap_mode_equal (authority0->wrap_mode_s, + authority1->wrap_mode_s) || + !compare_wrap_mode_equal (authority0->wrap_mode_t, + authority1->wrap_mode_t) || + !compare_wrap_mode_equal (authority0->wrap_mode_p, + authority1->wrap_mode_p)) + return FALSE; + + return TRUE; +} + +gboolean +_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; +} + +gboolean +_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; +} + +gboolean +_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); +} + +gboolean +_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; + } + } +} + +gboolean +cogl_pipeline_set_layer_combine (CoglPipeline *pipeline, + int layer_index, + const char *combine_description, + GError **error) +{ + CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_COMBINE; + CoglPipelineLayer *authority; + CoglPipelineLayer *layer; + CoglBlendStringStatement statements[2]; + CoglBlendStringStatement split[2]; + CoglBlendStringStatement *rgb; + CoglBlendStringStatement *a; + GError *internal_error = NULL; + 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, + &internal_error); + if (!count) + { + if (error) + g_propagate_error (error, internal_error); + else + { + g_warning ("Cannot compile combine description: %s\n", + internal_error->message); + g_error_free (internal_error); + } + 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: + + _cogl_pipeline_update_blend_enable (pipeline, COGL_PIPELINE_STATE_LAYERS); + 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: + + _cogl_pipeline_update_blend_enable (pipeline, COGL_PIPELINE_STATE_LAYERS); +} + +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); +} + +gboolean +_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_FILTERS); + + *min_filter = authority->min_filter; + *mag_filter = authority->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_FILTERS); + + *min_filter = authority->min_filter; + *mag_filter = authority->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_FILTERS); + + return authority->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_FILTERS); + + return authority->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_FILTERS; + 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 (authority->min_filter == min_filter && + authority->mag_filter == mag_filter) + 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 (old_authority->min_filter == min_filter && + old_authority->mag_filter == mag_filter) + { + layer->differences &= ~state; + + g_assert (layer->owner == pipeline); + if (layer->differences == 0) + _cogl_pipeline_prune_empty_layer_difference (pipeline, + layer); + return; + } + } + } + + layer->min_filter = min_filter; + layer->mag_filter = mag_filter; + + /* 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); + } +} + +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_filters_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + unsigned int hash = state->hash; + hash = _cogl_util_one_at_a_time_hash (hash, &authority->mag_filter, + sizeof (authority->mag_filter)); + hash = _cogl_util_one_at_a_time_hash (hash, &authority->min_filter, + sizeof (authority->min_filter)); + state->hash = hash; +} + +void +_cogl_pipeline_layer_hash_wrap_modes_state (CoglPipelineLayer *authority, + CoglPipelineLayer **authorities, + CoglPipelineHashState *state) +{ + unsigned int hash = state->hash; + hash = _cogl_util_one_at_a_time_hash (hash, &authority->wrap_mode_s, + sizeof (authority->wrap_mode_s)); + hash = _cogl_util_one_at_a_time_hash (hash, &authority->wrap_mode_t, + sizeof (authority->wrap_mode_t)); + hash = _cogl_util_one_at_a_time_hash (hash, &authority->wrap_mode_p, + sizeof (authority->wrap_mode_p)); + state->hash = hash; +} + +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; + gboolean 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..bfe0483 --- /dev/null +++ b/cogl/cogl-pipeline-layer-state.h @@ -0,0 +1,608 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PIPELINE_LAYER_STATE_H__ +#define __COGL_PIPELINE_LAYER_STATE_H__ + +#include +#include +#include +#include +#include + +G_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 texure_type); + +/** + * cogl_pipeline_get_layer_texture: + * @pipeline: A #CoglPipeline object + * @layer_index: the index of the layer + * + * Return value: 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 #GError 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_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_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 + */ +gboolean +cogl_pipeline_set_layer_combine (CoglPipeline *pipeline, + int layer_index, + const char *blend_string, + GError **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%. + * + * 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 #CoglHandle to a pipeline. + * @layer_index: the layer number to change. + * @enable: whether to enable point sprite coord generation. + * @error: A return location for a GError, 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: 2.0 + * Stability: unstable + */ +gboolean +cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, + int layer_index, + gboolean enable, + GError **error); + +/** + * cogl_pipeline_get_layer_point_sprite_coords_enabled: + * @pipeline: a #CoglHandle to a pipeline. + * @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 + */ +gboolean +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 */ + +G_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..558a8b6 --- /dev/null +++ b/cogl/cogl-pipeline-layer.c @@ -0,0 +1,832 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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" + +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; +} + +gboolean +_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 (!COGL_LIST_EMPTY (&snippets_authority->big_state->vertex_snippets)) + return TRUE; + snippets_authority = _cogl_pipeline_layer_get_authority + (layer, COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS); + if (!COGL_LIST_EMPTY (&snippets_authority->big_state->fragment_snippets)) + 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; +} + +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: + 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_FILTERS: + layer->min_filter = authority->min_filter; + layer->mag_filter = authority->mag_filter; + break; + case COGL_PIPELINE_LAYER_STATE_WRAP_MODES: + layer->wrap_mode_s = authority->wrap_mode_s; + layer->wrap_mode_t = authority->wrap_mode_t; + layer->wrap_mode_p = authority->wrap_mode_p; + break; + 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. */ + + _cogl_pipeline_fragend_layer_change_notify (required_owner, layer, change); + _cogl_pipeline_vertend_layer_change_notify (required_owner, layer, change); + _cogl_pipeline_progend_layer_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 gboolean +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); +} + +gboolean +_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_FILTERS && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_FILTERS_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_filters_equal)) + return FALSE; + + if (layers_difference & COGL_PIPELINE_LAYER_STATE_WRAP_MODES && + !layer_state_equal (COGL_PIPELINE_LAYER_STATE_WRAP_MODES_INDEX, + authorities0, authorities1, + _cogl_pipeline_layer_wrap_modes_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->mag_filter = COGL_PIPELINE_FILTER_LINEAR; + layer->min_filter = COGL_PIPELINE_FILTER_LINEAR; + + layer->wrap_mode_s = COGL_PIPELINE_WRAP_MODE_AUTOMATIC; + layer->wrap_mode_t = COGL_PIPELINE_WRAP_MODE_AUTOMATIC; + layer->wrap_mode_p = COGL_PIPELINE_WRAP_MODE_AUTOMATIC; + + 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... + */ +gboolean +_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-opengl-private.h b/cogl/cogl-pipeline-opengl-private.h new file mode 100644 index 0000000..be7b6d0 --- /dev/null +++ b/cogl/cogl-pipeline-opengl-private.h @@ -0,0 +1,153 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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. */ + gboolean 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. + */ + gboolean 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. */ + gboolean 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, + gboolean is_foreign); + +void +_cogl_delete_gl_texture (GLuint gl_texture); + +void +_cogl_gl_use_program_wrapper (CoglHandle program); + +void +_cogl_pipeline_flush_gl_state (CoglPipeline *pipeline, + gboolean skip_gl_state, + int n_tex_coord_attribs); + +#endif /* __COGL_PIPELINE_OPENGL_PRIVATE_H */ + diff --git a/cogl/cogl-pipeline-opengl.c b/cogl/cogl-pipeline-opengl.c new file mode 100644 index 0000000..a763240 --- /dev/null +++ b/cogl/cogl-pipeline-opengl.c @@ -0,0 +1,1422 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.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" + +/* This is needed to set the color attribute on GLES2 */ +#ifdef HAVE_COGL_GLES2 +#include "cogl-pipeline-progend-glsl-private.h" +#endif + +#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 + + +static void +texture_unit_init (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 (); + + 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 (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, + gboolean 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 gboolean +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 (CoglDepthState *depth_state) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->depth_test_function_cache != depth_state->test_function) + { + GE (ctx, glDepthFunc (depth_state->test_function)); + ctx->depth_test_function_cache = depth_state->test_function; + } + + if (ctx->depth_writing_enabled_cache != depth_state->write_enabled) + { + GE (ctx, glDepthMask (depth_state->write_enabled ? + GL_TRUE : GL_FALSE)); + ctx->depth_writing_enabled_cache = depth_state->write_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 (ctx->driver == COGL_DRIVER_GLES2) + 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; + } +} + +static void +_cogl_pipeline_flush_color_blend_alpha_depth_state ( + CoglPipeline *pipeline, + unsigned long pipelines_difference, + gboolean skip_gl_color) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* On GLES2 we'll flush the color later */ + if (ctx->driver != COGL_DRIVER_GLES2 && + !skip_gl_color) + { + 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_skip_gl_color) + { + 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_src_factor_rgb != + blend_state->blend_src_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 (ctx->driver != COGL_DRIVER_GLES2) + { + /* 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; + + if (depth_state->test_enabled) + { + if (ctx->depth_test_enabled_cache != TRUE) + { + GE (ctx, glEnable (GL_DEPTH_TEST)); + ctx->depth_test_enabled_cache = depth_state->test_enabled; + } + flush_depth_state (depth_state); + } + else if (ctx->depth_test_enabled_cache != FALSE) + { + GE (ctx, glDisable (GL_DEPTH_TEST)); + ctx->depth_test_enabled_cache = depth_state->test_enabled; + } + } + + 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 + { + gboolean 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; + } + } + } + + 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 (ctx->driver == COGL_DRIVER_GL) + { + /* 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 (ctx->driver == COGL_DRIVER_GLES2) + { + 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) /* not GLES2 */ + if (ctx->driver != COGL_DRIVER_GLES2) + { + /* 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 gboolean +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 gboolean 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; + } + + /* Under GLES2 the fragment shader will use gl_PointCoord instead of + replacing the texture coordinates */ +#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GL) + if (ctx->driver != COGL_DRIVER_GLES2 && + (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_handle_ref (layer); + if (unit->layer != COGL_INVALID_HANDLE) + cogl_handle_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, + gboolean skip_gl_color) +{ + CoglPipelineFlushLayerState state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _cogl_pipeline_flush_color_blend_alpha_depth_state (pipeline, + pipelines_difference, + skip_gl_color); + + 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) +{ + CoglPipelineWrapModeInternal 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_PIPELINE_WRAP_MODE_INTERNAL_AUTOMATIC) + gl_wrap_mode_s = GL_CLAMP_TO_EDGE; + else + gl_wrap_mode_s = wrap_mode_s; + + if (wrap_mode_t == COGL_PIPELINE_WRAP_MODE_INTERNAL_AUTOMATIC) + gl_wrap_mode_t = GL_CLAMP_TO_EDGE; + else + gl_wrap_mode_t = wrap_mode_t; + + if (wrap_mode_p == COGL_PIPELINE_WRAP_MODE_INTERNAL_AUTOMATIC) + gl_wrap_mode_p = GL_CLAMP_TO_EDGE; + else + gl_wrap_mode_p = wrap_mode_p; + + _cogl_texture_set_wrap_mode_parameters (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. + * + * XXX: GL_ARB_sampler_objects fixes this in OpenGL so we should + * eventually look at using this extension when available. + */ +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_set_filters (texture, min, mag); + + _cogl_pipeline_layer_forward_wrap_modes (unit->layer, texture); + } + } + } +} + +typedef struct +{ + int i; + unsigned long *layer_differences; +} CoglPipelineCompareLayersState; + +static gboolean +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 +{ + const CoglPipelineFragend *fragend; + CoglPipeline *pipeline; + unsigned long *layer_differences; + gboolean error_adding_layer; + gboolean added_layer; +} CoglPipelineFragendAddLayerState; + + +static gboolean +fragend_add_layer_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineFragendAddLayerState *state = user_data; + const CoglPipelineFragend *fragend = state->fragend; + CoglPipeline *pipeline = state->pipeline; + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* 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; +} + +typedef struct +{ + const CoglPipelineVertend *vertend; + CoglPipeline *pipeline; + unsigned long *layer_differences; + gboolean error_adding_layer; + gboolean added_layer; +} CoglPipelineVertendAddLayerState; + + +static gboolean +vertend_add_layer_cb (CoglPipelineLayer *layer, + void *user_data) +{ + CoglPipelineVertendAddLayerState *state = user_data; + const CoglPipelineVertend *vertend = state->vertend; + CoglPipeline *pipeline = state->pipeline; + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* Either enerate per layer code snippets or setup the + * fixed function matrix uniforms for each layer... */ + if (G_LIKELY (vertend->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 (CoglPipeline *pipeline, + gboolean skip_gl_color, + int n_tex_coord_attribs) +{ + unsigned long pipelines_difference; + int n_layers; + unsigned long *layer_differences; + int i; + CoglTextureUnit *unit1; + + COGL_STATIC_TIMER (pipeline_flush_timer, + "Mainloop", /* parent */ + "Material Flush", + "The time spent flushing material state", + 0 /* no application private data */); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + COGL_TIMER_START (_cogl_uprof_context, pipeline_flush_timer); + + if (ctx->current_pipeline == pipeline) + { + /* 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 (ctx->current_pipeline_age == pipeline->age && + ctx->current_pipeline_skip_gl_color == skip_gl_color) + goto done; + + pipelines_difference = ctx->current_pipeline_changes_since_flush; + } + else if (ctx->current_pipeline) + { + pipelines_difference = ctx->current_pipeline_changes_since_flush; + pipelines_difference |= + _cogl_pipeline_compare_differences (ctx->current_pipeline, + pipeline); + } + else + pipelines_difference = COGL_PIPELINE_STATE_ALL_SPARSE; + + /* 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 (layer_differences)); + state.i = 0; + state.layer_differences = layer_differences; + _cogl_pipeline_foreach_layer_internal (pipeline, + compare_layer_differences_cb, + &state); + } + else + layer_differences = NULL; + + /* Make sure we generate the texture coordinate array to be at least + the number of layers. This is important because the vertend will + try to pass along the corresponding varying for each layer + regardless of whether the fragment shader is actually using + it. Also it is possible that the application is assuming that if + the attribute isn't passed then it will default to 0,0. This is + what test-cogl-primitive does */ + if (n_layers > n_tex_coord_attribs) + n_tex_coord_attribs = n_layers; + + /* 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, + skip_gl_color); + + /* Now flush the fragment processing state according to the current + * fragment processing backend. + * + * Note: Some of the backends may not support the current pipeline + * configuration and in that case it will report an error and we + * will fallback to a different backend. + * + * NB: if pipeline->backend != COGL_PIPELINE_FRAGEND_UNDEFINED then + * we have previously managed to successfully flush this pipeline + * with the given backend so we will simply use that to avoid + * fallback code paths. + */ + + if (pipeline->fragend == COGL_PIPELINE_FRAGEND_UNDEFINED) + _cogl_pipeline_set_fragend (pipeline, COGL_PIPELINE_FRAGEND_DEFAULT); + + for (i = pipeline->fragend; + i < G_N_ELEMENTS (_cogl_pipeline_fragends); + i++, _cogl_pipeline_set_fragend (pipeline, i)) + { + const CoglPipelineFragend *fragend = _cogl_pipeline_fragends[i]; + CoglPipelineFragendAddLayerState state; + + /* E.g. For fragends generating code they can setup their + * scratch buffers here... */ + if (G_UNLIKELY (!fragend->start (pipeline, + n_layers, + pipelines_difference, + n_tex_coord_attribs))) + continue; + + state.fragend = fragend; + state.pipeline = pipeline; + state.layer_differences = layer_differences; + state.error_adding_layer = FALSE; + state.added_layer = FALSE; + _cogl_pipeline_foreach_layer_internal (pipeline, + fragend_add_layer_cb, + &state); + + if (G_UNLIKELY (state.error_adding_layer)) + continue; + + if (!state.added_layer && + fragend->passthrough && + G_UNLIKELY (!fragend->passthrough (pipeline))) + continue; + + /* For fragends generating code they may compile and link their + * programs here, update any uniforms and tell OpenGL to use + * that program. + */ + if (G_UNLIKELY (!fragend->end (pipeline, pipelines_difference))) + continue; + + break; + } + + if (G_UNLIKELY (i >= G_N_ELEMENTS (_cogl_pipeline_fragends))) + g_warning ("No usable pipeline fragment backend was found!"); + + /* Now flush the vertex processing state according to the current + * vertex processing backend. + */ + + if (pipeline->vertend == COGL_PIPELINE_VERTEND_UNDEFINED) + _cogl_pipeline_set_vertend (pipeline, COGL_PIPELINE_VERTEND_DEFAULT); + + for (i = pipeline->vertend; + i < G_N_ELEMENTS (_cogl_pipeline_vertends); + i++, _cogl_pipeline_set_vertend (pipeline, i)) + { + const CoglPipelineVertend *vertend = _cogl_pipeline_vertends[i]; + CoglPipelineVertendAddLayerState state; + + /* E.g. For vertends generating code they can setup their + * scratch buffers here... */ + if (G_UNLIKELY (!vertend->start (pipeline, + n_layers, + pipelines_difference, + n_tex_coord_attribs))) + continue; + + 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; + + /* For vertends generating code they may compile and link their + * programs here, update any uniforms and tell OpenGL to use + * that program. + */ + if (G_UNLIKELY (!vertend->end (pipeline, pipelines_difference))) + continue; + + break; + } + + if (G_UNLIKELY (i >= G_N_ELEMENTS (_cogl_pipeline_vertends))) + g_warning ("No usable pipeline vertex backend was found!"); + + for (i = 0; i < COGL_PIPELINE_N_PROGENDS; i++) + if (_cogl_pipeline_progends[i]->end) + _cogl_pipeline_progends[i]->end (pipeline, pipelines_difference, + n_tex_coord_attribs); + + /* 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_skip_gl_color = skip_gl_color; + ctx->current_pipeline_age = pipeline->age; + +done: + + /* We can't assume the color will be retained between flushes on + GLES2 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 */ +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2 && !skip_gl_color) + { + 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))); + } +#endif + + /* Give any progends a chance to update any uniforms that might not + depend on the material state. This is used on GLES2 to update the + matrices */ + for (i = 0; i < COGL_PIPELINE_N_PROGENDS; i++) + if (_cogl_pipeline_progends[i]->pre_paint) + _cogl_pipeline_progends[i]->pre_paint (pipeline); + + /* Handle the fact that OpenGL associates texture filter and wrap + * modes with the texture objects not the texture units... */ + 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/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h new file mode 100644 index 0000000..b88e401 --- /dev/null +++ b/cogl/cogl-pipeline-private.h @@ -0,0 +1,1030 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010,2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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-queue.h" +#include "cogl-internal.h" +#include "cogl-boxed-value.h" +#include "cogl-pipeline-snippet-private.h" +#include "cogl-pipeline-state.h" + +#include + +#ifdef HAVE_COGL_GL + +#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_FRAGEND_GLSL 0 +#ifdef HAVE_COGL_GLES +#define COGL_PIPELINE_FRAGEND_FIXED 1 +#define COGL_PIPELINE_N_FRAGENDS 2 +#else +#define COGL_PIPELINE_N_FRAGENDS 1 +#endif + +#else /* HAVE_COGL_GLES2 */ + +#ifdef HAVE_COGL_GLES +#define COGL_PIPELINE_FRAGEND_FIXED 0 +#define COGL_PIPELINE_N_FRAGENDS 1 +#else +#error No drivers defined +#endif + +#endif /* HAVE_COGL_GLES2 */ + +#endif /* HAVE_COGL_GL */ + +#ifdef COGL_PIPELINE_FRAGEND_ARBFP +#define COGL_PIPELINE_FRAGEND_ARBFP_MASK \ + (1 << COGL_PIPELINE_FRAGEND_ARBFP) +#endif +#ifdef COGL_PIPELINE_FRAGEND_FIXED +#define COGL_PIPELINE_FRAGEND_FIXED_MASK \ + (1 << COGL_PIPELINE_FRAGEND_FIXED) +#endif +#ifdef COGL_PIPELINE_FRAGEND_GLSL +#define COGL_PIPELINE_FRAGEND_GLSL_MASK \ + (1 << COGL_PIPELINE_FRAGEND_GLSL) +#endif + +#define COGL_PIPELINE_FRAGEND_DEFAULT 0 +#define COGL_PIPELINE_FRAGEND_UNDEFINED 3 + +#ifdef HAVE_COGL_GL + +#define COGL_PIPELINE_VERTEND_FIXED 0 +#define COGL_PIPELINE_VERTEND_GLSL 1 +#define COGL_PIPELINE_N_VERTENDS 2 + +#else /* HAVE_COGL_GL */ + +#ifdef HAVE_COGL_GLES2 + +#define COGL_PIPELINE_VERTEND_GLSL 0 +#ifdef HAVE_COGL_GLES +#define COGL_PIPELINE_VERTEND_FIXED 1 +#define COGL_PIPELINE_N_VERTENDS 2 +#else +#define COGL_PIPELINE_N_VERTENDS 1 +#endif + +#else /* HAVE_COGL_GLES2 */ + +#ifdef HAVE_COGL_GLES +#define COGL_PIPELINE_VERTEND_FIXED 0 +#define COGL_PIPELINE_N_VERTENDS 1 +#else +#error No drivers defined +#endif /* HAVE_COGL_GLES */ + +#endif /* HAVE_COGL_GLES2 */ + +#endif /* HAVE_COGL_GL */ + +#ifdef COGL_PIPELINE_VERTEND_FIXED +#define COGL_PIPELINE_VERTEND_FIXED_MASK \ + (1 << COGL_PIPELINE_VERTEND_FIXED) +#endif +#ifdef COGL_PIPELINE_VERTEND_GLSL +#define COGL_PIPELINE_VERTEND_GLSL_MASK \ + (1 << COGL_PIPELINE_VERTEND_GLSL) +#endif + +#define COGL_PIPELINE_VERTEND_DEFAULT 0 +#define COGL_PIPELINE_VERTEND_UNDEFINED 3 + +#define COGL_PIPELINE_VERTEND_DEFAULT 0 +#define COGL_PIPELINE_VERTEND_UNDEFINED 3 + +/* If we have either of the GLSL backends then we also need a GLSL + progend to combine the shaders generated into a single + program. Same goes for the fixed progends which are used to flush + the matrices */ +#ifdef COGL_PIPELINE_FRAGEND_FIXED + +#define COGL_PIPELINE_PROGEND_FIXED 0 + +#ifdef COGL_PIPELINE_FRAGEND_GLSL +#define COGL_PIPELINE_PROGEND_GLSL 1 +#define COGL_PIPELINE_N_PROGENDS 2 +#else +#define COGL_PIPELINE_N_PROGENDS 1 +#endif + +#else /* COGL_PIPELINE_FRAGEND_FIXED */ + +#ifdef COGL_PIPELINE_FRAGEND_GLSL +#define COGL_PIPELINE_PROGEND_GLSL 0 +#define COGL_PIPELINE_N_PROGENDS 1 +#else +#define COGL_PIPELINE_N_PROGENDS 0 +#endif + +#endif /* COGL_PIPELINE_FRAGEND_FIXED */ + +/* 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_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; + + /* 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 long journal_ref_count; + + /* 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; + + /* A mask of which sparse state groups are different in this + * pipeline in comparison to its parent. */ + unsigned long 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 long 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 */ + GList *layer_differences; + unsigned int n_layers; + + /* 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; + + /* 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; + + /* 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; + + unsigned int layers_cache_dirty:1; + unsigned int deprecated_get_layers_list_dirty:1; + + /* 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; + + /* There are multiple fragment processing backends for CoglPipeline, + * glsl, arbfp and fixed. This identifies the backend being used for + * the pipeline and any private state the backend has associated + * with the pipeline. */ + unsigned int fragend:3; + unsigned int vertend:3; +}; + +typedef struct _CoglPipelineFragend +{ + gboolean (*start) (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference, + int n_tex_coord_attribs); + gboolean (*add_layer) (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference); + gboolean (*passthrough) (CoglPipeline *pipeline); + gboolean (*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 +{ + gboolean (*start) (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference, + int n_tex_coord_attribs); + gboolean (*add_layer) (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference); + gboolean (*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 +{ + void (*end) (CoglPipeline *pipeline, + unsigned long pipelines_difference, + int n_tex_coord_attribs); + 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); +} 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 gboolean (*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, + gboolean from_layer_change); + +void +_cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline); + +void _cogl_pipeline_update_blend_enable (CoglPipeline *pipeline, + CoglPipelineState changes); + +typedef enum +{ + COGL_PIPELINE_GET_LAYER_NO_CREATE +} 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) + +gboolean +_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. + */ + +gboolean +_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 guint32 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 guint32 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; + + guint32 fallback_layers; + guint32 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_fragend (CoglPipeline *pipeline, int fragend); + +void +_cogl_pipeline_set_vertend (CoglPipeline *pipeline, int vertend); + +CoglPipeline * +_cogl_pipeline_get_parent (CoglPipeline *pipeline); + +void +_cogl_pipeline_get_colorubv (CoglPipeline *pipeline, + guint8 *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); + +gboolean +_cogl_pipeline_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1, + unsigned long differences, + unsigned long layer_differences, + CoglPipelineEvalFlags flags); + +unsigned int +_cogl_pipeline_hash (CoglPipeline *pipeline, + unsigned long differences, + unsigned long layer_differences, + CoglPipelineEvalFlags flags); + +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); + +gboolean +_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline); + +void +_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline, + const char *breadcrumb); + +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, + gboolean inc_n_layers); + +void +_cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + gboolean 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 gboolean (*CoglPipelineInternalLayerCallback) (CoglPipelineLayer *layer, + void *user_data); + +void +_cogl_pipeline_foreach_layer_internal (CoglPipeline *pipeline, + CoglPipelineInternalLayerCallback callback, + void *user_data); + +gboolean +_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); + +void +_cogl_pipeline_fragend_layer_change_notify (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change); + +CoglPipelineLayerState +_cogl_pipeline_get_layer_state_for_fragment_codegen (CoglContext *context); + +CoglPipelineState +_cogl_pipeline_get_state_for_fragment_codegen (CoglContext *context); + +void +_cogl_pipeline_vertend_layer_change_notify (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change); + +void +_cogl_pipeline_progend_layer_change_notify (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change); + +#endif /* __COGL_PIPELINE_PRIVATE_H */ + diff --git a/cogl/cogl-pipeline-progend-fixed-private.h b/cogl/cogl-pipeline-progend-fixed-private.h new file mode 100644 index 0000000..a256059 --- /dev/null +++ b/cogl/cogl-pipeline-progend-fixed-private.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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/cogl-pipeline-progend-fixed.c b/cogl/cogl-pipeline-progend-fixed.c new file mode 100644 index 0000000..d715439 --- /dev/null +++ b/cogl/cogl-pipeline-progend-fixed.c @@ -0,0 +1,69 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-pipeline-private.h" + +#ifdef COGL_PIPELINE_PROGEND_FIXED + +#include "cogl-context.h" +#include "cogl-context-private.h" + +static void +_cogl_pipeline_progend_fixed_pre_paint (CoglPipeline *pipeline) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (pipeline->vertend != COGL_PIPELINE_VERTEND_FIXED) + return; + + if (ctx->current_projection_stack) + _cogl_matrix_stack_flush_to_gl_builtins (ctx, + ctx->current_projection_stack, + COGL_MATRIX_PROJECTION, + FALSE /* enable flip */); + if (ctx->current_modelview_stack) + _cogl_matrix_stack_flush_to_gl_builtins (ctx, + ctx->current_modelview_stack, + COGL_MATRIX_MODELVIEW, + FALSE /* enable flip */); +} + +const CoglPipelineProgend _cogl_pipeline_fixed_progend = + { + 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/cogl-pipeline-progend-glsl-private.h b/cogl/cogl-pipeline-progend-glsl-private.h new file mode 100644 index 0000000..a080204 --- /dev/null +++ b/cogl/cogl-pipeline-progend-glsl-private.h @@ -0,0 +1,41 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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/cogl-pipeline-progend-glsl.c b/cogl/cogl-pipeline-progend-glsl.c new file mode 100644 index 0000000..6d7cf43 --- /dev/null +++ b/cogl/cogl-pipeline-progend-glsl.c @@ -0,0 +1,1107 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-offscreen.h" + +#ifdef COGL_PIPELINE_PROGEND_GLSL + +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.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" + +#ifdef HAVE_COGL_GLES2 + +/* These are used to generalise updating some uniforms that are + required when building for GLES2 */ + +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; +} BuiltinUniformData; + +static BuiltinUniformData builtin_uniforms[] = + { + { "cogl_point_size_in", + cogl_pipeline_get_point_size, update_float_uniform, + COGL_PIPELINE_STATE_POINT_SIZE }, + { "_cogl_alpha_test_ref", + cogl_pipeline_get_alpha_test_reference, update_float_uniform, + COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE } + }; + +#endif /* HAVE_COGL_GLES2 */ + +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; + + /* To allow writing shaders that are portable between GLES 2 and + * OpenGL Cogl prepends a number of boilerplate #defines and + * declarations to user shaders. One of those declarations is an + * array of texture coordinate varyings, but to know how to emit the + * declaration we need to know how many texture coordinate + * attributes are in use. The boilerplate also needs to be changed + * if this changes. */ + int n_tex_coord_attribs; + +#ifdef HAVE_COGL_GLES2 + unsigned long dirty_builtin_uniforms; + GLint builtin_uniform_locations[G_N_ELEMENTS (builtin_uniforms)]; + + GLint modelview_uniform; + GLint projection_uniform; + GLint mvp_uniform; + + CoglMatrixStackCache projection_cache; + CoglMatrixStackCache modelview_cache; +#endif + + /* 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; +} 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; + } +} + +#ifdef HAVE_COGL_GLES2 + +static void +clear_flushed_matrix_stacks (CoglPipelineProgramState *program_state) +{ + _cogl_matrix_stack_destroy_cache (&program_state->projection_cache); + _cogl_matrix_stack_init_cache (&program_state->projection_cache); + _cogl_matrix_stack_destroy_cache (&program_state->modelview_cache); + _cogl_matrix_stack_init_cache (&program_state->modelview_cache); +} + +#endif /* HAVE_COGL_GLES2 */ + +static CoglPipelineProgramState * +program_state_new (int n_layers) +{ + CoglPipelineProgramState *program_state; + + program_state = g_slice_new (CoglPipelineProgramState); + program_state->ref_count = 1; + program_state->program = 0; + program_state->n_tex_coord_attribs = 0; + program_state->unit_state = g_new (UnitState, n_layers); + program_state->uniform_locations = NULL; + program_state->attribute_locations = NULL; +#ifdef HAVE_COGL_GLES2 + _cogl_matrix_stack_init_cache (&program_state->modelview_cache); + _cogl_matrix_stack_init_cache (&program_state->projection_cache); +#endif + + 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->ref_count == 0) + { + clear_attribute_cache (program_state); + +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + { + _cogl_matrix_stack_destroy_cache (&program_state->projection_cache); + _cogl_matrix_stack_destroy_cache (&program_state->modelview_cache); + } +#endif + + 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) +{ + _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; + gboolean update_all; + CoglPipelineProgramState *program_state; +} UpdateUniformsState; + +static gboolean +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; + +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + { + g_string_set_size (ctx->codegen_source_buffer, 0); + g_string_append_printf (ctx->codegen_source_buffer, + "cogl_texture_matrix[%i]", state->unit); + + GE_RET( uniform_location, + ctx, glGetUniformLocation (state->gl_program, + ctx->codegen_source_buffer->str) ); + + unit_state->texture_matrix_uniform = uniform_location; + } +#endif + + state->unit++; + + return TRUE; +} + +static gboolean +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; + } + +#ifdef HAVE_COGL_GLES2 + + if (ctx->driver == COGL_DRIVER_GLES2 && + 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; + } + +#endif /* HAVE_COGL_GLES2 */ + + return TRUE; +} + +#ifdef HAVE_COGL_GLES2 + +static void +update_builtin_uniforms (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 ((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; +} + +#endif /* HAVE_COGL_GLES2 */ + +typedef struct +{ + CoglPipelineProgramState *program_state; + unsigned long *uniform_differences; + int n_differences; + CoglContext *ctx; + const CoglBoxedValue *values; + int value_index; +} FlushUniformsClosure; + +static gboolean +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, + gboolean 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 void +_cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline, + unsigned long pipelines_difference, + int n_tex_coord_attribs) +{ + CoglPipelineProgramState *program_state; + GLuint gl_program; + gboolean program_changed = FALSE; + UpdateUniformsState state; + CoglProgram *user_program; + CoglPipeline *template_pipeline = NULL; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* If neither of the glsl fragend or vertends are used then we don't + need to do anything */ + if (pipeline->fragend != COGL_PIPELINE_FRAGEND_GLSL && + pipeline->vertend != COGL_PIPELINE_VERTEND_GLSL) + return; + + 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_STATE_AFFECTS_VERTEX_CODEGEN | + _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)))) + { + template_pipeline = + _cogl_pipeline_cache_get_combined_template (ctx->pipeline_cache, + authority); + + program_state = get_program_state (template_pipeline); + } + + if (program_state) + program_state->ref_count++; + else + program_state + = program_state_new (cogl_pipeline_get_n_layers (authority)); + + set_program_state (authority, program_state); + + if (template_pipeline) + { + program_state->ref_count++; + set_program_state (template_pipeline, program_state); + } + } + + if (authority != pipeline) + { + program_state->ref_count++; + set_program_state (pipeline, program_state); + } + } + + /* If the program has changed since the last link then we do + * need to relink + * + * Also if the number of texture coordinate attributes in use has + * changed, then delete the program so we can prepend a new + * _cogl_tex_coord[] varying array declaration. */ + if ((program_state->program && user_program && + user_program->age != program_state->user_program_age) || + (ctx->driver == COGL_DRIVER_GLES2 && + n_tex_coord_attribs != program_state->n_tex_coord_attribs)) + { + 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, n_tex_coord_attribs); + + 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 (pipeline->fragend == COGL_PIPELINE_FRAGEND_GLSL && + (backend_shader = _cogl_pipeline_fragend_glsl_get_shader (pipeline))) + GE( ctx, glAttachShader (program_state->program, backend_shader) ); + if (pipeline->vertend == COGL_PIPELINE_VERTEND_GLSL && + (backend_shader = _cogl_pipeline_vertend_glsl_get_shader (pipeline))) + GE( ctx, glAttachShader (program_state->program, backend_shader) ); + + link_program (program_state->program); + + program_changed = TRUE; + + program_state->n_tex_coord_attribs = n_tex_coord_attribs; + } + + gl_program = program_state->program; + + if (pipeline->fragend == COGL_PIPELINE_FRAGEND_GLSL) + _cogl_use_fragment_program (gl_program, COGL_PIPELINE_PROGRAM_TYPE_GLSL); + if (pipeline->vertend == COGL_PIPELINE_VERTEND_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); + +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + { + if (program_changed) + { + int i; + + clear_flushed_matrix_stacks (program_state); + + for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) + 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 (pipeline, gl_program, program_state); + } +#endif + + _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_fragment_codegen (ctx))) + dirty_program_state (pipeline); + +#ifdef HAVE_COGL_GLES2 + else if (ctx->driver == COGL_DRIVER_GLES2) + { + int i; + + for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) + if ((change & builtin_uniforms[i].change)) + { + CoglPipelineProgramState *program_state + = get_program_state (pipeline); + if (program_state) + program_state->dirty_builtin_uniforms |= 1 << i; + return; + } + } +#endif /* HAVE_COGL_GLES2 */ +} + +/* 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_state_for_fragment_codegen (ctx))) + { + dirty_program_state (owner); + return; + } + + 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; + } + } + + 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) +{ + gboolean needs_flip; + CoglMatrixStack *projection_stack; + CoglMatrixStack *modelview_stack; + CoglPipelineProgramState *program_state; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (pipeline->vertend != COGL_PIPELINE_VERTEND_GLSL) + return; + + program_state = get_program_state (pipeline); + + projection_stack = ctx->current_projection_stack; + modelview_stack = ctx->current_modelview_stack; + + /* 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_stack == NULL || projection_stack == NULL) + return; + + needs_flip = cogl_is_offscreen (ctx->current_draw_buffer); + +#ifdef HAVE_COGL_GLES2 + if (ctx->driver == COGL_DRIVER_GLES2) + { + gboolean modelview_changed; + gboolean projection_changed; + gboolean need_modelview; + gboolean need_projection; + CoglMatrix modelview, projection; + + projection_changed = + _cogl_matrix_stack_check_and_update_cache (projection_stack, + &program_state-> + projection_cache, + needs_flip && + program_state-> + flip_uniform == -1); + + modelview_changed = + _cogl_matrix_stack_check_and_update_cache (modelview_stack, + &program_state-> + modelview_cache, + /* 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_stack_get (modelview_stack, &modelview); + if (need_projection) + { + if (needs_flip && program_state->flip_uniform == -1) + { + CoglMatrix tmp_matrix; + _cogl_matrix_stack_get (projection_stack, &tmp_matrix); + cogl_matrix_multiply (&projection, + &ctx->y_flip_matrix, + &tmp_matrix); + } + else + _cogl_matrix_stack_get (projection_stack, &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_stack_has_identity_flag (modelview_stack)) + { + 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))); + } + } + } + } + else +#endif + { + gboolean disable_flip; + + /* If there are vertex snippets, then we'll disable flipping the + geometry via the matrix and use the flip vertex instead */ + disable_flip = program_state->flip_uniform != -1; + + _cogl_matrix_stack_flush_to_gl_builtins (ctx, + projection_stack, + COGL_MATRIX_PROJECTION, + disable_flip); + _cogl_matrix_stack_flush_to_gl_builtins (ctx, + modelview_stack, + COGL_MATRIX_MODELVIEW, + disable_flip); + } + + 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; + } +} + +#ifdef HAVE_COGL_GLES2 + +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) ); +} + +#endif + +const CoglPipelineProgend _cogl_pipeline_glsl_progend = + { + _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/cogl-pipeline-snippet-private.h b/cogl/cogl-pipeline-snippet-private.h new file mode 100644 index 0000000..823193e --- /dev/null +++ b/cogl/cogl-pipeline-snippet-private.h @@ -0,0 +1,110 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_PIPELINE_SNIPPET_PRIVATE_H +#define __COGL_PIPELINE_SNIPPET_PRIVATE_H + +#include "cogl-snippet.h" +#include "cogl-queue.h" + +typedef struct _CoglPipelineSnippet CoglPipelineSnippet; + +COGL_LIST_HEAD (CoglPipelineSnippetList, CoglPipelineSnippet); + +struct _CoglPipelineSnippet +{ + COGL_LIST_ENTRY (CoglPipelineSnippet) list_node; + + CoglSnippet *snippet; +}; + +/* 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 */ + gboolean 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_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); + +gboolean +_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..2e37741 --- /dev/null +++ b/cogl/cogl-pipeline-snippet.c @@ -0,0 +1,276 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#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) +{ + CoglPipelineSnippet *first_snippet, *snippet; + int snippet_num = 0; + int n_snippets = 0; + + first_snippet = COGL_LIST_FIRST (data->snippets); + + /* First count the number of snippets so we can easily tell when + we're at the last one */ + COGL_LIST_FOREACH (snippet, data->snippets, list_node) + if (snippet->snippet->hook == data->hook) + { + /* Don't bother processing any previous snippets if we reach + one that has a replacement */ + if (snippet->snippet->replace) + { + n_snippets = 1; + first_snippet = snippet; + } + 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 (snippet = first_snippet, snippet_num = 0; + snippet_num < n_snippets; + snippet = COGL_LIST_NEXT (snippet, list_node), snippet_num++) + if (snippet->snippet->hook == data->hook) + { + const char *source; + + if ((source = cogl_snippet_get_declarations (snippet->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->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->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->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"); + } +} + +static void +_cogl_pipeline_snippet_free (CoglPipelineSnippet *pipeline_snippet) +{ + cogl_object_unref (pipeline_snippet->snippet); + g_slice_free (CoglPipelineSnippet, pipeline_snippet); +} + +void +_cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list) +{ + CoglPipelineSnippet *pipeline_snippet, *tmp; + + COGL_LIST_FOREACH_SAFE (pipeline_snippet, list, list_node, tmp) + _cogl_pipeline_snippet_free (pipeline_snippet); +} + +void +_cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list, + CoglSnippet *snippet) +{ + CoglPipelineSnippet *pipeline_snippet = g_slice_new (CoglPipelineSnippet); + + pipeline_snippet->snippet = cogl_object_ref (snippet); + + _cogl_snippet_make_immutable (pipeline_snippet->snippet); + + if (COGL_LIST_EMPTY (list)) + COGL_LIST_INSERT_HEAD (list, pipeline_snippet, list_node); + else + { + CoglPipelineSnippet *tail; + + for (tail = COGL_LIST_FIRST (list); + COGL_LIST_NEXT (tail, list_node); + tail = COGL_LIST_NEXT (tail, list_node)); + + COGL_LIST_INSERT_AFTER (tail, pipeline_snippet, list_node); + } +} + +void +_cogl_pipeline_snippet_list_copy (CoglPipelineSnippetList *dst, + const CoglPipelineSnippetList *src) +{ + CoglPipelineSnippet *tail = NULL; + const CoglPipelineSnippet *l; + + COGL_LIST_INIT (dst); + + COGL_LIST_FOREACH (l, src, list_node) + { + CoglPipelineSnippet *copy = g_slice_dup (CoglPipelineSnippet, l); + + cogl_object_ref (copy->snippet); + + if (tail) + COGL_LIST_INSERT_AFTER (tail, copy, list_node); + else + COGL_LIST_INSERT_HEAD (dst, copy, list_node); + + tail = copy; + } +} + +void +_cogl_pipeline_snippet_list_hash (CoglPipelineSnippetList *list, + unsigned int *hash) +{ + CoglPipelineSnippet *l; + + COGL_LIST_FOREACH (l, list, list_node) + { + *hash = _cogl_util_one_at_a_time_hash (*hash, + &l->snippet, + sizeof (CoglSnippet *)); + } +} + +gboolean +_cogl_pipeline_snippet_list_equal (CoglPipelineSnippetList *list0, + CoglPipelineSnippetList *list1) +{ + CoglPipelineSnippet *l0, *l1; + + for (l0 = COGL_LIST_FIRST (list0), l1 = COGL_LIST_FIRST (list1); + l0 && l1; + l0 = COGL_LIST_NEXT (l0, list_node), l1 = COGL_LIST_NEXT (l1, list_node)) + if (l0->snippet != l1->snippet) + 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..2bc162d --- /dev/null +++ b/cogl/cogl-pipeline-state-private.h @@ -0,0 +1,175 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_PIPELINE_STATE_PRIVATE_H +#define __COGL_PIPELINE_STATE_PRIVATE_H + +CoglPipeline * +_cogl_pipeline_get_user_program (CoglPipeline *pipeline); + +gboolean +_cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline); + +gboolean +_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline); + +gboolean +_cogl_pipeline_has_non_layer_vertex_snippets (CoglPipeline *pipeline); + +gboolean +_cogl_pipeline_has_non_layer_fragment_snippets (CoglPipeline *pipeline); + +void +_cogl_pipeline_set_fog_state (CoglPipeline *pipeline, + const CoglPipelineFogState *fog_state); + +gboolean +_cogl_pipeline_color_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_lighting_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_alpha_func_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_alpha_func_reference_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_blend_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_depth_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_fog_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_logic_ops_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_user_shader_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_cull_face_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_uniforms_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_cogl_pipeline_vertex_snippets_state_equal (CoglPipeline *authority0, + CoglPipeline *authority1); + +gboolean +_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_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..4b18d23 --- /dev/null +++ b/cogl/cogl-pipeline-state.c @@ -0,0 +1,2002 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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 "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; +} + +gboolean +_cogl_pipeline_color_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return cogl_color_equal (&authority0->color, &authority1->color); +} + +gboolean +_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; +} + +gboolean +_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; +} + +gboolean +_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); +} + +gboolean +_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 defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + if (ctx->driver != COGL_DRIVER_GLES1) + { + 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; + } +#endif + 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 defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + if (ctx->driver != COGL_DRIVER_GLES1 && + (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; + } +#endif + + return TRUE; +} + +gboolean +_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; + } +} + +gboolean +_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; +} + +gboolean +_cogl_pipeline_point_size_equal (CoglPipeline *authority0, + CoglPipeline *authority1) +{ + return authority0->big_state->point_size == authority1->big_state->point_size; +} + +gboolean +_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; +} + +gboolean +_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); +} + +gboolean +_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 gboolean +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); +} + +gboolean +_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; +} + +gboolean +_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); +} + +gboolean +_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, + guint8 *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); + + _cogl_pipeline_update_blend_enable (pipeline, state); +} + +void +cogl_pipeline_set_color4ub (CoglPipeline *pipeline, + guint8 red, + guint8 green, + guint8 blue, + guint8 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 gboolean +_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); + + _cogl_pipeline_update_blend_enable (pipeline, state); +} + +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); + + _cogl_pipeline_update_blend_enable (pipeline, state); +} + +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); + + _cogl_pipeline_update_blend_enable (pipeline, state); +} + +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); + + _cogl_pipeline_update_blend_enable (pipeline, state); +} + +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); + + _cogl_pipeline_update_blend_enable (pipeline, state); +} + +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]); +} + +gboolean +cogl_pipeline_set_blend (CoglPipeline *pipeline, + const char *blend_description, + GError **error) +{ + CoglPipelineState state = COGL_PIPELINE_STATE_BLEND; + CoglPipeline *authority; + CoglBlendStringStatement statements[2]; + CoglBlendStringStatement *rgb; + CoglBlendStringStatement *a; + GError *internal_error = NULL; + 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, + &internal_error); + if (!count) + { + if (error) + g_propagate_error (error, internal_error); + else + { + g_warning ("Cannot compile blend description: %s\n", + internal_error->message); + g_error_free (internal_error); + } + 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; +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2) + if (ctx->driver != COGL_DRIVER_GLES1) + { + 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); + } + else +#endif + { + setup_blend_state (rgb, + NULL, + &blend_state->blend_src_factor_rgb, + &blend_state->blend_dst_factor_rgb); + } + + /* 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); + } + + _cogl_pipeline_update_blend_enable (pipeline, state); + + 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 (ctx->driver == COGL_DRIVER_GLES1) + 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); + + _cogl_pipeline_update_blend_enable (pipeline, state); + } +#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_fragend (pipeline, COGL_PIPELINE_FRAGEND_DEFAULT); + _cogl_pipeline_set_vertend (pipeline, COGL_PIPELINE_VERTEND_DEFAULT); + } + + /* 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; + + _cogl_pipeline_update_blend_enable (pipeline, state); +} + +gboolean +cogl_pipeline_set_depth_state (CoglPipeline *pipeline, + const CoglDepthState *depth_state, + GError **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)) + { + g_set_error (error, + COGL_ERROR, + COGL_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; +} + +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; + + /* - 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); +} + +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, + gboolean 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); +} + +gboolean +_cogl_pipeline_has_non_layer_vertex_snippets (CoglPipeline *pipeline) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_VERTEX_SNIPPETS); + + return !COGL_LIST_EMPTY (&authority->big_state->vertex_snippets); +} + +static gboolean +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); + gboolean *found_vertex_snippet = user_data; + + if (!COGL_LIST_EMPTY (&authority->big_state->vertex_snippets)) + { + *found_vertex_snippet = TRUE; + return FALSE; + } + + return TRUE; +} + +gboolean +_cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline) +{ + gboolean 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; +} + +gboolean +_cogl_pipeline_has_non_layer_fragment_snippets (CoglPipeline *pipeline) +{ + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS); + + return !COGL_LIST_EMPTY (&authority->big_state->fragment_snippets); +} + +static gboolean +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); + gboolean *found_fragment_snippet = user_data; + + if (!COGL_LIST_EMPTY (&authority->big_state->fragment_snippets)) + { + *found_fragment_snippet = TRUE; + return FALSE; + } + + return TRUE; +} + +gboolean +_cogl_pipeline_has_fragment_snippets (CoglPipeline *pipeline) +{ + gboolean 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) +{ + guint8 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; + +#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) + if (ctx->driver != COGL_DRIVER_GLES1) + { + 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)); + } + } +#endif + + 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) + { + guint8 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) + { + guint8 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_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_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); +} diff --git a/cogl/cogl-pipeline-state.h b/cogl/cogl-pipeline-state.h new file mode 100644 index 0000000..8686629 --- /dev/null +++ b/cogl/cogl-pipeline-state.h @@ -0,0 +1,920 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PIPELINE_STATE_H__ +#define __COGL_PIPELINE_STATE_H__ + +#include +#include +#include +#include + +G_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, + guint8 red, + guint8 green, + guint8 blue, + guint8 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 #GError 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 + */ +gboolean +cogl_pipeline_set_blend (CoglPipeline *pipeline, + const char *blend_string, + GError **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 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: 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_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: 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 #GError 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 + */ +gboolean +cogl_pipeline_set_depth_state (CoglPipeline *pipeline, + const CoglDepthState *state, + GError **error); + +/** + * cogl_pipeline_get_depth_state + * @pipeline: A #CoglPipeline object + * @state: 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: + * + * 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_set_front_face_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 + * 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, + gboolean 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 */ + +G_END_DECLS + +#endif /* __COGL_PIPELINE_STATE_H__ */ diff --git a/cogl/cogl-pipeline-vertend-fixed-private.h b/cogl/cogl-pipeline-vertend-fixed-private.h new file mode 100644 index 0000000..59bce34 --- /dev/null +++ b/cogl/cogl-pipeline-vertend-fixed-private.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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/cogl-pipeline-vertend-fixed.c b/cogl/cogl-pipeline-vertend-fixed.c new file mode 100644 index 0000000..2df593b --- /dev/null +++ b/cogl/cogl-pipeline-vertend-fixed.c @@ -0,0 +1,136 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-state-private.h" +#include "cogl-pipeline-opengl-private.h" + +#ifdef COGL_PIPELINE_VERTEND_FIXED + +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.h" +#include "cogl-program-private.h" + +const CoglPipelineVertend _cogl_pipeline_fixed_vertend; + +static gboolean +_cogl_pipeline_vertend_fixed_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference, + int n_tex_coord_attribs) +{ + CoglProgram *user_program; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED))) + return FALSE; + + if (ctx->driver == COGL_DRIVER_GLES2) + return FALSE; + + /* Vertex snippets are only supported in the GLSL fragend */ + if (_cogl_pipeline_has_vertex_snippets (pipeline)) + return FALSE; + + /* If there is a user program with a vertex shader then the + appropriate backend for that language should handle it. We can + still use the fixed vertex backend if the program only contains + a fragment shader */ + user_program = cogl_pipeline_get_user_program (pipeline); + if (user_program != COGL_INVALID_HANDLE && + _cogl_program_has_vertex_shader (user_program)) + return FALSE; + + _cogl_use_vertex_program (0, COGL_PIPELINE_PROGRAM_TYPE_FIXED); + + return TRUE; +} + +static gboolean +_cogl_pipeline_vertend_fixed_add_layer (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference) +{ + int unit_index = _cogl_pipeline_layer_get_unit_index (layer); + CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index); + + _COGL_GET_CONTEXT (ctx, FALSE); + + 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); + + _cogl_matrix_stack_set (unit->matrix_stack, + &authority->big_state->matrix); + + _cogl_set_active_texture_unit (unit_index); + + _cogl_matrix_stack_flush_to_gl_builtins (ctx, unit->matrix_stack, + COGL_MATRIX_TEXTURE, + FALSE /* enable flip */); + } + + return TRUE; +} + +static gboolean +_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); + + 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/cogl-pipeline-vertend-glsl-private.h b/cogl/cogl-pipeline-vertend-glsl-private.h new file mode 100644 index 0000000..52a078c --- /dev/null +++ b/cogl/cogl-pipeline-vertend-glsl-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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/cogl-pipeline-vertend-glsl.c b/cogl/cogl-pipeline-vertend-glsl.c new file mode 100644 index 0000000..6ecec90 --- /dev/null +++ b/cogl/cogl-pipeline-vertend-glsl.c @@ -0,0 +1,561 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-context-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" + +#ifdef COGL_PIPELINE_VERTEND_GLSL + +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.h" +#include "cogl-program-private.h" +#include "cogl-pipeline-vertend-glsl-private.h" +#include "cogl-pipeline-state-private.h" + +const CoglPipelineVertend _cogl_pipeline_glsl_vertend; + +typedef struct +{ + unsigned int ref_count; + + GLuint gl_shader; + GString *header, *source; + + /* Age of the user program that was current when the shader was + generated. We need to keep track of this because if the user + program changes then we may need to redecide whether to generate + a shader at all */ + unsigned int user_program_age; + + /* The number of tex coord attributes that the shader was generated + for. If this changes on GLES2 then we need to regenerate the + shader */ + int n_tex_coord_attribs; +} CoglPipelineShaderState; + +static CoglUserDataKey shader_state_key; + +static CoglPipelineShaderState * +shader_state_new (void) +{ + CoglPipelineShaderState *shader_state; + + shader_state = g_slice_new0 (CoglPipelineShaderState); + shader_state->ref_count = 1; + + 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) +{ + CoglPipelineShaderState *shader_state = user_data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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) +{ + 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 gboolean +_cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline, + int n_layers, + unsigned long pipelines_difference, + int n_tex_coord_attribs) +{ + CoglPipelineShaderState *shader_state; + CoglPipeline *template_pipeline = NULL; + CoglProgram *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 the user program has a vertex shader that isn't GLSL then the + appropriate vertend for that language should handle it */ + if (user_program && + _cogl_program_has_vertex_shader (user_program) && + _cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_GLSL) + return FALSE; + + /* 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_STATE_AFFECTS_VERTEX_CODEGEN & + ~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)))) + { + template_pipeline = + _cogl_pipeline_cache_get_vertex_template (ctx->pipeline_cache, + authority); + + shader_state = get_shader_state (template_pipeline); + } + + if (shader_state) + shader_state->ref_count++; + else + shader_state = shader_state_new (); + + set_shader_state (authority, shader_state); + + if (template_pipeline) + { + shader_state->ref_count++; + set_shader_state (template_pipeline, shader_state); + } + } + + if (authority != pipeline) + { + shader_state->ref_count++; + set_shader_state (pipeline, shader_state); + } + } + + if (shader_state->gl_shader) + { + /* If we already have a valid GLSL shader then we don't need to + generate a new one. However if there's a user program and it + has changed since the last link then we do need a new + shader. If the number of tex coord attribs changes on GLES2 + then we need to regenerate the shader with a different boiler + plate */ + if ((user_program == NULL || + shader_state->user_program_age == user_program->age) + && (ctx->driver != COGL_DRIVER_GLES2 || + shader_state->n_tex_coord_attribs == n_tex_coord_attribs)) + return TRUE; + + /* We need to recreate the shader so destroy the existing one */ + GE( ctx, glDeleteShader (shader_state->gl_shader) ); + shader_state->gl_shader = 0; + } + + /* 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 */ + + if (user_program) + shader_state->user_program_age = user_program->age; + + shader_state->n_tex_coord_attribs = n_tex_coord_attribs; + + /* If the user program contains a vertex shader then we don't need + to generate one */ + if (user_program && + _cogl_program_has_vertex_shader (user_program)) + return TRUE; + + /* 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; + + g_string_append (shader_state->source, + "void\n" + "cogl_generated_source ()\n" + "{\n"); + + if (ctx->driver == COGL_DRIVER_GLES2) + /* There is no builtin uniform for the pointsize on GLES2 so we need + to copy it from the custom uniform in the vertex shader */ + g_string_append (shader_state->source, + " cogl_point_size_out = cogl_point_size_in;\n"); + + return TRUE; +} + +static gboolean +_cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + unsigned long layers_difference) +{ + CoglPipelineShaderState *shader_state; + CoglPipelineSnippetData snippet_data; + int unit_index; + + _COGL_GET_CONTEXT (ctx, FALSE); + + shader_state = get_shader_state (pipeline); + + unit_index = _cogl_pipeline_layer_get_unit_index (layer); + + if (ctx->driver != COGL_DRIVER_GLES2) + { + /* We are using the fixed function uniforms for the user matrices + and the only way to set them is with the fixed function API so we + still need to flush them here */ + 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); + CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index); + + _cogl_matrix_stack_set (unit->matrix_stack, + &authority->big_state->matrix); + + _cogl_set_active_texture_unit (unit_index); + + _cogl_matrix_stack_flush_to_gl_builtins (ctx, + unit->matrix_stack, + COGL_MATRIX_TEXTURE, + FALSE /* do flip */); + } + } + + 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", + unit_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", + unit_index); + snippet_data.final_name = g_strdup_printf ("cogl_transform_layer%i", + unit_index); + snippet_data.function_prefix = g_strdup_printf ("cogl_transform_layer%i", + unit_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_out[%i] = " + "cogl_transform_layer%i (cogl_texture_matrix[%i],\n" + " " + " cogl_tex_coord%i_in);\n", + unit_index, + unit_index, + unit_index, + unit_index); + + return TRUE; +} + +static gboolean +_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; + + 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" + " 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 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_shader_set_source_with_boilerplate (shader, GL_VERTEX_SHADER, + shader_state + ->n_tex_coord_attribs, + 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; + } + + if (ctx->driver == COGL_DRIVER_GL && + (pipelines_difference & COGL_PIPELINE_STATE_POINT_SIZE)) + { + CoglPipeline *authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE); + + GE( ctx, glPointSize (authority->big_state->point_size) ); + } + + return TRUE; +} + +static void +_cogl_pipeline_vertend_glsl_pre_change_notify (CoglPipeline *pipeline, + CoglPipelineState change, + const CoglColor *new_color) +{ + if ((change & COGL_PIPELINE_STATE_AFFECTS_VERTEX_CODEGEN)) + 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 + }; + +#endif /* COGL_PIPELINE_VERTEND_GLSL */ diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c new file mode 100644 index 0000000..7ee1b29 --- /dev/null +++ b/cogl/cogl-pipeline.c @@ -0,0 +1,2931 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-internal.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 +#include +#include + +static void _cogl_pipeline_free (CoglPipeline *tex); +static void recursively_free_layer_caches (CoglPipeline *pipeline); +static gboolean _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 +#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); + +/* + * 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] = + &_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->fragend = COGL_PIPELINE_FRAGEND_UNDEFINED; + pipeline->vertend = COGL_PIPELINE_VERTEND_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 = 1.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 gboolean +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, + gboolean 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->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED && + _cogl_pipeline_fragends[pipeline->fragend]->pipeline_set_parent_notify) + { + const CoglPipelineFragend *fragend = + _cogl_pipeline_fragends[pipeline->fragend]; + 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, gboolean 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; + + /* 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->fragend = src->fragend; + + pipeline->vertend = src->vertend; + + 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); + _cogl_pipeline_set_static_breadcrumb (new, "new"); + return new; +} + +static gboolean +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); +} + +gboolean +_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; + gboolean 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); + } +} + +typedef struct +{ + int i; + int *indices; +} AppendLayerIndexState; + +static gboolean +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; + gboolean 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 gboolean +layer_has_alpha_cb (CoglPipelineLayer *layer, void *data) +{ + gboolean *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); +} + +static gboolean +_cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline, + unsigned long changes, + const CoglColor *override_color) +{ + CoglPipeline *enable_authority; + CoglPipeline *blend_authority; + CoglPipelineBlendState *blend_state; + CoglPipelineBlendEnable enabled; + unsigned long other_state; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING))) + return FALSE; + + 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 awkward cases that are equivalent to + * blending being disable, where the output is simply GL_SRC_COLOR. + * + * Note: we assume that all OpenGL drivers will identify the simple + * case of ADD (ONE, ZERO) as equivalent to blending being disabled. + * + * We should update this when we add support for more blend + * functions... + */ + +#if defined (HAVE_COGL_GLES2) || defined (HAVE_COGL_GL) + if (ctx->driver != COGL_DRIVER_GLES1) + { + /* GLES 1 can't change the function or have separate alpha factors */ + 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; + } +#endif + + 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 */ + + /* 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 + * GL_PREVIOUS layer. */ + if (changes & COGL_PIPELINE_STATE_LAYERS) + changes = COGL_PIPELINE_STATE_AFFECTS_BLENDING; + + 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. */ + gboolean has_alpha = FALSE; + _cogl_pipeline_foreach_layer_internal (pipeline, + layer_has_alpha_cb, + &has_alpha); + if (has_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. In this case we still need to + * go and check the other state... + * + * FIXME: We should 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) + { + other_state = COGL_PIPELINE_STATE_AFFECTS_BLENDING & ~changes; + if (other_state && + _cogl_pipeline_needs_blending_enabled (pipeline, + other_state, + NULL)) + return TRUE; + } + + return FALSE; +} + +void +_cogl_pipeline_set_fragend (CoglPipeline *pipeline, int fragend) +{ + pipeline->fragend = fragend; +} + +void +_cogl_pipeline_set_vertend (CoglPipeline *pipeline, int vertend) +{ + pipeline->vertend = vertend; +} + +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_POINT_SIZE) + big_state->point_size = src->big_state->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) + _cogl_pipeline_update_blend_enable (dest, differences); + + 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_POINT_SIZE: + case COGL_PIPELINE_STATE_USER_SHADER: + 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 gboolean +check_if_strong_cb (CoglNode *node, void *user_data) +{ + CoglPipeline *pipeline = COGL_PIPELINE (node); + gboolean *has_strong_child = user_data; + + if (!_cogl_pipeline_is_weak (pipeline)) + { + *has_strong_child = TRUE; + return FALSE; + } + + return TRUE; +} + +static gboolean +has_strong_children (CoglPipeline *pipeline) +{ + gboolean has_strong_child = FALSE; + _cogl_pipeline_node_foreach_child (COGL_NODE (pipeline), + check_if_strong_cb, + &has_strong_child); + return has_strong_child; +} + +static gboolean +_cogl_pipeline_is_weak (CoglPipeline *pipeline) +{ + if (pipeline->is_weak && !has_strong_children (pipeline)) + return TRUE; + else + return FALSE; +} + +static gboolean +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, + gboolean 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) + { + gboolean 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) + { + gboolean will_need_blending = + _cogl_pipeline_needs_blending_enabled (pipeline, + change, + new_color); + gboolean 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 (); + } + } + + /* The fixed function backend has no private state and can't + * do anything special to handle small pipeline changes so we may as + * well try to find a better backend whenever the pipeline changes. + * + * The programmable backends may be able to cache a lot of the code + * they generate and only need to update a small section of that + * code in response to a pipeline change therefore we don't want to + * try searching for another backend when the pipeline changes. + */ +#ifdef COGL_PIPELINE_FRAGEND_FIXED + if (pipeline->fragend == COGL_PIPELINE_FRAGEND_FIXED) + _cogl_pipeline_set_fragend (pipeline, COGL_PIPELINE_FRAGEND_UNDEFINED); +#endif +#ifdef COGL_PIPELINE_VERTEND_FIXED + if (pipeline->vertend == COGL_PIPELINE_VERTEND_FIXED) + _cogl_pipeline_set_vertend (pipeline, COGL_PIPELINE_VERTEND_UNDEFINED); +#endif + + /* 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 notification 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. + */ + if (!from_layer_change) + { + int i; + + if (pipeline->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED && + _cogl_pipeline_fragends[pipeline->fragend]->pipeline_pre_change_notify) + { + const CoglPipelineFragend *fragend = + _cogl_pipeline_fragends[pipeline->fragend]; + fragend->pipeline_pre_change_notify (pipeline, change, new_color); + } + + if (pipeline->vertend != COGL_PIPELINE_VERTEND_UNDEFINED && + _cogl_pipeline_vertends[pipeline->vertend]->pipeline_pre_change_notify) + { + const CoglPipelineVertend *vertend = + _cogl_pipeline_vertends[pipeline->vertend]; + vertend->pipeline_pre_change_notify (pipeline, change, new_color); + } + + for (i = 0; i < COGL_PIPELINE_N_PROGENDS; i++) + if (_cogl_pipeline_progends[i]->pipeline_pre_change_notify) + _cogl_pipeline_progends[i]->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)); + _cogl_pipeline_set_static_breadcrumb (new_authority, + "pre_change_notify:copy-on-write"); + + /* 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, + gboolean 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++; +} + +void +_cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline, + CoglPipelineLayer *layer, + gboolean dec_n_layers) +{ + _COGL_RETURN_IF_FAIL (layer->owner == pipeline); + + /* - 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); + + layer->owner = NULL; + cogl_object_unref (layer); + + pipeline->differences |= COGL_PIPELINE_STATE_LAYERS; + + pipeline->layer_differences = + g_list_remove (pipeline->layer_differences, layer); + + 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_blend_enable (CoglPipeline *pipeline, + CoglPipelineState change) +{ + gboolean blend_enable = + _cogl_pipeline_needs_blending_enabled (pipeline, change, NULL); + + if (blend_enable != pipeline->real_blend_enable) + { + /* - 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, + COGL_PIPELINE_STATE_REAL_BLEND_ENABLE, + NULL, + FALSE); + pipeline->real_blend_enable = blend_enable; + } +} + +typedef struct +{ + int keep_n; + int current_pos; + int first_index_to_prune; +} CoglPipelinePruneLayersInfo; + +static gboolean +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; + + _cogl_pipeline_pre_change_notify (pipeline, + COGL_PIPELINE_STATE_LAYERS, + NULL, + FALSE); + + state.keep_n = n; + state.current_pos = 0; + _cogl_pipeline_foreach_layer_internal (pipeline, + update_prune_layers_info_cb, + &state); + + 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; +} + +void +_cogl_pipeline_fragend_layer_change_notify (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + /* 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 (owner->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED && + _cogl_pipeline_fragends[owner->fragend]->layer_pre_change_notify) + { + const CoglPipelineFragend *fragend = + _cogl_pipeline_fragends[owner->fragend]; + fragend->layer_pre_change_notify (owner, layer, change); + } +} + +void +_cogl_pipeline_vertend_layer_change_notify (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + /* NB: The comment in fragend_layer_change_notify applies here too */ + if (owner->vertend != COGL_PIPELINE_VERTEND_UNDEFINED && + _cogl_pipeline_vertends[owner->vertend]->layer_pre_change_notify) + { + const CoglPipelineVertend *vertend = + _cogl_pipeline_vertends[owner->vertend]; + vertend->layer_pre_change_notify (owner, layer, change); + } +} + +void +_cogl_pipeline_progend_layer_change_notify (CoglPipeline *owner, + CoglPipelineLayer *layer, + CoglPipelineLayerState change) +{ + int i; + + /* Give all of the progends a chance to notice that the layer has + changed */ + for (i = 0; i < COGL_PIPELINE_N_PROGENDS; i++) + if (_cogl_pipeline_progends[i]->layer_pre_change_notify) + _cogl_pipeline_progends[i]->layer_pre_change_notify (owner, + layer, + change); +} + +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. */ + gboolean ignore_shift_layers_if_found; + +} CoglPipelineLayerInfo; + +/* Returns TRUE once we know there is nothing more to update */ +static gboolean +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 gboolean +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 gboolean +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; + CoglHandle texture; +} CoglPipelineOverrideLayerState; + +static gboolean +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 gboolean +_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. + */ +gboolean +_cogl_pipeline_equal (CoglPipeline *pipeline0, + CoglPipeline *pipeline1, + unsigned long 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; + gboolean 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; + + /* 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_POINT_SIZE_INDEX: + if (!_cogl_pipeline_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)) + { + gboolean 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); + } +} + +gboolean +_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); + + _cogl_pipeline_update_blend_enable (pipeline, COGL_PIPELINE_STATE_LAYERS); +} + +static gboolean +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); +} + +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; +} + +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_FILTERS_INDEX] = + _cogl_pipeline_layer_hash_filters_state; + layer_state_hash_functions[COGL_PIPELINE_LAYER_STATE_WRAP_MODES_INDEX] = + _cogl_pipeline_layer_hash_wrap_modes_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! */ + g_assert (COGL_PIPELINE_LAYER_STATE_SPARSE_COUNT == 11); +} + +static gboolean +_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_POINT_SIZE_INDEX] = + _cogl_pipeline_hash_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! */ + g_assert (COGL_PIPELINE_STATE_SPARSE_COUNT == 16); +} + +unsigned int +_cogl_pipeline_hash (CoglPipeline *pipeline, + unsigned long differences, + unsigned long layer_differences, + CoglPipelineEvalFlags flags) +{ + CoglPipeline *authorities[COGL_PIPELINE_STATE_SPARSE_COUNT]; + unsigned long mask; + int i; + CoglPipelineHashState state; + unsigned int final_hash = 0; + + state.hash = 0; + state.layer_differences = layer_differences; + state.flags = flags; + + /* hash non-sparse state */ + + if (differences & COGL_PIPELINE_STATE_REAL_BLEND_ENABLE) + { + gboolean 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 long current_state = (1L< differences) + break; + } + + return _cogl_util_one_at_a_time_mix (final_hash); +} + +typedef struct +{ + int i; + CoglPipelineLayer **layers; +} AddLayersToArrayState; + +static gboolean +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; +} + +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 (context->driver == COGL_DRIVER_GLES2) + 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 (context->driver == COGL_DRIVER_GLES2) + 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..d990e24 --- /dev/null +++ b/cogl/cogl-pipeline.h @@ -0,0 +1,173 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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 + +G_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) + +/** + * cogl_pipeline_new: + * @context: a #CoglContext + * + * Allocates and initializes a default simple pipeline that will color + * a primitive white. + * + * Return value: 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. + * + * Returns: a pointer to the newly allocated #CoglPipeline + * + * Since: 2.0 + * Stability: Unstable + */ +CoglPipeline * +cogl_pipeline_copy (CoglPipeline *source); + +/** + * cogl_is_pipeline: + * @handle: A CoglHandle + * + * Gets whether the given handle references an existing pipeline object. + * + * Return value: %TRUE if the handle references a #CoglPipeline, + * %FALSE otherwise + * + * Since: 2.0 + * Stability: Unstable + */ +gboolean +cogl_is_pipeline (CoglHandle handle); + +/** + * 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 gboolean (*CoglPipelineLayerCallback) (CoglPipeline *pipeline, + int layer_index, + void *user_data); + +/** + * cogl_pipeline_foreach_layer: + * @pipeline: A #CoglPipeline object + * @callback: A #CoglPipelineLayerCallback 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 @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 */ + +G_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..5db2a27 --- /dev/null +++ b/cogl/cogl-pixel-buffer-private.h @@ -0,0 +1,45 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#ifndef __COGL_PIXEL_BUFFER_PRIVATE_H__ +#define __COGL_PIXEL_BUFFER_PRIVATE_H__ + +#include "cogl-handle.h" +#include "cogl-buffer-private.h" + +#include + +G_BEGIN_DECLS + +struct _CoglPixelBuffer +{ + CoglBuffer _parent; +}; + +G_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..4fd5fa5 --- /dev/null +++ b/cogl/cogl-pixel-buffer.c @@ -0,0 +1,111 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * 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" + +/* + * 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) + +CoglPixelBuffer * +cogl_pixel_buffer_new (CoglContext *context, + gsize size, + const void *data) +{ + CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer); + CoglBuffer *buffer = COGL_BUFFER (pixel_buffer); + gboolean use_malloc; + + if (!(context->private_feature_flags & COGL_PRIVATE_FEATURE_PBOS)) + use_malloc = TRUE; + else + use_malloc = FALSE; + + /* parent's constructor */ + _cogl_buffer_initialize (buffer, + context, + size, + use_malloc, + 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) + cogl_buffer_set_data (COGL_BUFFER (pixel_buffer), + 0, + data, + size); + + return pixel_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..49bd603 --- /dev/null +++ b/cogl/cogl-pixel-buffer.h @@ -0,0 +1,128 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Damien Lespiau + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_PIXEL_BUFFER_H__ +#define __COGL_PIXEL_BUFFER_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +/* All of the cogl-pixel-buffer API is currently experimental so we + * suffix the actual symbols with _EXP so if somone is monitoring for + * ABI changes it will hopefully be clearer to them what's going on if + * any of the symbols dissapear at a later date. + */ + +#define COGL_PIXEL_BUFFER(buffer) ((CoglPixelBuffer *)(buffer)) + +#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP +#define cogl_pixel_buffer_new_with_size cogl_pixel_buffer_new_with_size_EXP +#define cogl_is_pixel_buffer cogl_is_pixel_buffer_EXP +#if 0 +#define cogl_pixel_buffer_set_region cogl_pixel_buffer_set_region_EXP +#endif + +typedef struct _CoglPixelBuffer CoglPixelBuffer; + +/** + * 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. + * + * Since: 1.10 + * Stability: unstable + */ +CoglPixelBuffer * +cogl_pixel_buffer_new (CoglContext *context, + gsize size, + const void *data); + +/** + * cogl_is_pixel_buffer: + * @object: a #CoglObject to test + * + * Checks whether @handle is a pixel array. + * + * Return value: %TRUE if the @handle is a pixel array, and %FALSE + * otherwise + * + * Since: 1.2 + * Stability: Unstable + */ +gboolean +cogl_is_pixel_buffer (void *object); + +#if 0 +/* + * cogl_pixel_buffer_set_region: + * @array: the #CoglHandle of a pixel array + * @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 + */ +gboolean +cogl_pixel_buffer_set_region (CoglHandle array, + guint8 *data, + unsigned int src_width, + unsigned int src_height, + unsigned int src_rowstride, + unsigned int dst_x, + unsigned int dst_y); +#endif + +G_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..6b534b6 --- /dev/null +++ b/cogl/cogl-point-in-poly-private.h @@ -0,0 +1,40 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + */ + +#ifndef __COGL_POINT_INT_POLYGON_PRIVATE_H +#define __COGL_POINT_INT_POLYGON_PRIVATE_H + +#include + +G_BEGIN_DECLS + +int +_cogl_util_point_in_screen_poly (float point_x, + float point_y, + void *vertices, + size_t stride, + int n_vertices); + +G_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..71c6882 --- /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 *)((guint8 *)vertices + i * stride); + float vert_xj = *(float *)((guint8 *)vertices + j * stride); + float vert_yi = *(float *)((guint8 *)vertices + i * stride + + sizeof (float)); + float vert_yj = *(float *)((guint8 *)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.c b/cogl/cogl-poll.c new file mode 100644 index 0000000..4501f47 --- /dev/null +++ b/cogl/cogl-poll.c @@ -0,0 +1,77 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see . + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-poll.h" +#include "cogl-winsys-private.h" +#include "cogl-context-private.h" + +void +cogl_poll_get_info (CoglContext *context, + CoglPollFD **poll_fds, + int *n_poll_fds, + gint64 *timeout) +{ + const CoglWinsysVtable *winsys; + + _COGL_RETURN_IF_FAIL (cogl_is_context (context)); + _COGL_RETURN_IF_FAIL (poll_fds != NULL); + _COGL_RETURN_IF_FAIL (n_poll_fds != NULL); + _COGL_RETURN_IF_FAIL (timeout != NULL); + + winsys = _cogl_context_get_winsys (context); + + if (winsys->poll_get_info) + { + winsys->poll_get_info (context, + poll_fds, + n_poll_fds, + timeout); + return; + } + + /* By default we'll assume Cogl doesn't need to block on anything */ + *poll_fds = NULL; + *n_poll_fds = 0; + *timeout = -1; /* no timeout */ +} + +void +cogl_poll_dispatch (CoglContext *context, + const CoglPollFD *poll_fds, + int n_poll_fds) +{ + const CoglWinsysVtable *winsys; + + _COGL_RETURN_IF_FAIL (cogl_is_context (context)); + + winsys = _cogl_context_get_winsys (context); + + if (winsys->poll_dispatch) + winsys->poll_dispatch (context, poll_fds, n_poll_fds); +} diff --git a/cogl/cogl-poll.h b/cogl/cogl-poll.h new file mode 100644 index 0000000..9c520b6 --- /dev/null +++ b/cogl/cogl-poll.h @@ -0,0 +1,168 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_POLL_H__ +#define __COGL_POLL_H__ + +#include +#include +#include + +G_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: + * + * 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_get_info: + * @context: A #CoglContext + * @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. + * + * This should be called whenever an application is about to go idle + * so that Cogl has a chance to describe what state it needs to be + * woken up on. The assumption is that the application is using a main + * loop with something like the poll function call on Unix or the GLib + * main loop. + * + * 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. Either way it should pass a pointer to either array back to + * Cogl when calling cogl_poll_dispatch(). + * + * 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 zero if + * Cogl needs to be woken up immediately. + * + * Stability: unstable + * Since: 1.10 + */ +void +cogl_poll_get_info (CoglContext *context, + CoglPollFD **poll_fds, + int *n_poll_fds, + gint64 *timeout); + +/** + * cogl_poll_dispatch: + * @context: A #CoglContext + * @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 from + * cogl_context_begin_idle() or a shorter array missing some file + * descriptors that Cogl requested. + * + * Stability: unstable + * Since: 1.10 + */ +void +cogl_poll_dispatch (CoglContext *context, + const CoglPollFD *poll_fds, + int n_poll_fds); + +G_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..c3fd991 --- /dev/null +++ b/cogl/cogl-primitive-private.h @@ -0,0 +1,64 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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" + +struct _CoglPrimitive +{ + CoglObject _parent; + + CoglVerticesMode mode; + int first_vertex; + int n_vertices; + CoglIndices *indices; + + 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, + CoglDrawFlags flags); + +#endif /* __COGL_PRIMITIVE_PRIVATE_H */ + diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c new file mode 100644 index 0000000..c7f7a4e --- /dev/null +++ b/cogl/cogl-primitive.c @@ -0,0 +1,598 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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 +#include + +static void _cogl_primitive_free (CoglPrimitive *primitive); + +COGL_OBJECT_DEFINE (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); + + g_slice_free1 (sizeof (CoglPrimitive) + + sizeof (CoglAttribute *) * + (primitive->n_embedded_attributes - 1), primitive); +} + +static void +warn_about_midscene_changes (void) +{ + static gboolean 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; +} diff --git a/cogl/cogl-primitive.h b/cogl/cogl-primitive.h new file mode 100644 index 0000000..134bb87 --- /dev/null +++ b/cogl/cogl-primitive.h @@ -0,0 +1,877 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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 + +G_BEGIN_DECLS + +/** + * SECTION:cogl-primitive + * @short_description: Functions for creating, manipulating and drawing + * primitives + * + * FIXME + */ + +/** + * 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_with_v2_attributes(). + * + * 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_with_v3_attributes(). + * + * 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_with_v2c4_attributes(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct +{ + float x, y; + guint8 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_with_v3c4_attributes(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct +{ + float x, y, z; + guint8 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_with_v2t2_attributes(). + * + * 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_with_v3t2_attributes(). + * + * 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_with_v3t2c4_attributes(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct +{ + float x, y; + float s, t; + guint8 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_with_v3t2c4_attributes(). + * + * Since: 1.6 + * Stability: Unstable + */ +typedef struct +{ + float x, y, z; + float s, t; + guint8 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 + * @Varargs: 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. + * + * Returns: A newly allocated #CoglPrimitive object + * + * Since: 1.6 + * Stability: Unstable + */ +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); + +/** + * 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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); + +#define cogl_primitive_get_n_vertices cogl_primitive_get_n_vertices_EXP +/** + * 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); + +#define cogl_primitive_set_n_vertices cogl_primitive_set_n_vertices_EXP +/** + * 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: A %NULL terminated array of #CoglAttribute + * pointers + * + * 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); + +#define cogl_primitive_set_indices cogl_primitive_set_indices_EXP +/** + * 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: 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: 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 handle references a #CoglPrimitive, + * %FALSE otherwise + * + * Since: 1.6 + * Stability: Unstable + */ +gboolean +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 gboolean (* CoglPrimitiveAttributeCallback) (CoglPrimitive *primitive, + CoglAttribute *attribute, + void *user_data); + +/** + * cogl_primitive_foreach_attribute: + * @primitive: A #CoglPrimitive object + * @callback: A #CoglPrimitiveAttributeCallback to be called for each attribute + * @user_data: 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); + +G_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..859bcae --- /dev/null +++ b/cogl/cogl-primitives-private.h @@ -0,0 +1,60 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_PRIMITIVES_PRIVATE_H +#define __COGL_PRIMITIVES_PRIVATE_H + +#include + +G_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, + gboolean disable_legacy_state); + +G_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..7323498 --- /dev/null +++ b/cogl/cogl-primitives.c @@ -0,0 +1,1142 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-internal.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; + gboolean flipped_x; + gboolean 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 gboolean +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; + gboolean tex_virtual_flipped_x; + gboolean tex_virtual_flipped_y; + gboolean quad_flipped_x; + gboolean 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; + gboolean needs_multiple_primitives; +} ValidateTexCoordsState; + +/* + * Validate the texture coordinates for this rectangle. + */ +static gboolean +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 gboolean 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 gboolean 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 gboolean +_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; + gboolean all_use_sliced_quad_fallback; +} ValidateLayerState; + +static gboolean +_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 gboolean 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 gboolean 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 gboolean 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, + gboolean 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) + { + gboolean 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 gboolean +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 gboolean +_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, + gboolean use_color) +{ + CoglPipeline *pipeline; + ValidateState validate_state; + int n_layers; + int n_attributes; + CoglAttribute **attributes; + int i; + unsigned int stride; + gsize 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; + guint8 *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 = (guint8 *) (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..f638056 --- /dev/null +++ b/cogl/cogl-primitives.h @@ -0,0 +1,190 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_PRIMITIVES_H +#define __COGL_PRIMITIVES_H + +#include + +G_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, + gboolean use_color); + +G_END_DECLS + +#endif /* __COGL_PRIMITIVES_H */ diff --git a/cogl/cogl-private.h b/cogl/cogl-private.h new file mode 100644 index 0000000..6130c11 --- /dev/null +++ b/cogl/cogl-private.h @@ -0,0 +1,109 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_PRIVATE_H__ +#define __COGL_PRIVATE_H__ + +#include + +#include "cogl-context.h" + +G_BEGIN_DECLS + +gboolean +_cogl_gl_update_features (CoglContext *context, + GError **error); + +gboolean +_cogl_gles_update_features (CoglContext *context, + GError **error); + +gboolean +_cogl_check_extension (const char *name, const char *ext); + +void +_cogl_clear (const CoglColor *color, unsigned long buffers); + +void +_cogl_init (void); + +void +_cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy); + +gboolean +_cogl_get_enable_legacy_state (void); + +/* + * _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. + */ +gboolean +_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) + +G_END_DECLS + +#endif /* __COGL_PRIVATE_H__ */ diff --git a/cogl/cogl-profile.c b/cogl/cogl-profile.c new file mode 100644 index 0000000..c06d8a5 --- /dev/null +++ b/cogl/cogl-profile.c @@ -0,0 +1,84 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef COGL_ENABLE_PROFILE + +#include "cogl-profile.h" +#include "cogl-debug.h" + +#include +#include + +UProfContext *_cogl_uprof_context; + +static gboolean +debug_option_getter (void *user_data) +{ + unsigned int shift = GPOINTER_TO_UINT (user_data); + return COGL_DEBUG_ENABLED (shift); +} + +static void +debug_option_setter (gboolean 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")) + { + UProfReport *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"); +#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..1d058f7 --- /dev/null +++ b/cogl/cogl-profile.h @@ -0,0 +1,61 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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-program-private.h b/cogl/cogl-program-private.h new file mode 100644 index 0000000..5c33f61 --- /dev/null +++ b/cogl/cogl-program-private.h @@ -0,0 +1,82 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_PROGRAM_H +#define __COGL_PROGRAM_H + +#include "cogl-handle.h" +#include "cogl-internal.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, + gboolean gl_program_changed); + +CoglShaderLanguage +_cogl_program_get_language (CoglHandle handle); + +gboolean +_cogl_program_has_fragment_shader (CoglHandle handle); + +gboolean +_cogl_program_has_vertex_shader (CoglHandle handle); + +#endif /* __COGL_PROGRAM_H */ diff --git a/cogl/cogl-program.c b/cogl/cogl-program.c new file mode 100644 index 0000000..3d265ff --- /dev/null +++ b/cogl/cogl-program.c @@ -0,0 +1,496 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#include "cogl-util.h" +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.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, + gboolean 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, + gboolean 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, + gboolean 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 gboolean +_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; +} + +gboolean +_cogl_program_has_fragment_shader (CoglHandle handle) +{ + return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_FRAGMENT); +} + +gboolean +_cogl_program_has_vertex_shader (CoglHandle handle) +{ + return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_VERTEX); +} diff --git a/cogl/cogl-quaternion-private.h b/cogl/cogl-quaternion-private.h new file mode 100644 index 0000000..882e341 --- /dev/null +++ b/cogl/cogl-quaternion-private.h @@ -0,0 +1,39 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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. + * + * 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..cfb8031 --- /dev/null +++ b/cogl/cogl-quaternion.c @@ -0,0 +1,660 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * 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 +#include + +#define FLOAT_EPSILON 1e-03 + +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; + } +} + +gboolean +cogl_quaternion_equal (gconstpointer v1, gconstpointer 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) +{ + result->w = a->w * b->w - a->x * b->x - a->y * b->y - a->z * b->z; + + result->x = a->w * b->x + a->x * b->w + a->y * b->z - a->z * b->y; + result->y = a->w * b->y + a->y * b->w + a->z * b->x - a->x * b->z; + result->z = a->w * b->z + a->z * b->w + a->x * b->y - a->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); +} + +/** + * cogl_quaternion_squad: + * + */ +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..eb60bcd --- /dev/null +++ b/cogl/cogl-quaternion.h @@ -0,0 +1,511 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_QUATERNION_H__ +#define __COGL_QUATERNION_H__ + +#include +#include + +G_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 + +/** + * 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: + * |[ + * [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 + * + * + * + * + * + * + * + * + * + * @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 + */ +struct _CoglQuaternion +{ + float w; + + float x; + float y; + float z; + + float padding0; + float padding1; + float padding2; + float padding3; +}; +COGL_STRUCT_SIZE_ASSERT (CoglQuaternion, 32); + +/** + * 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 + * @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 (x,y,z),w + * + * 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 y axis + * + * + * Since: 2.0 + */ +void +cogl_quaternion_init_from_z_rotation (CoglQuaternion *quaternion, + float angle); + +void +cogl_quaternion_init_from_euler (CoglQuaternion *quaternion, + const CoglEuler *euler); + +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 + */ +gboolean +cogl_quaternion_equal (gconstpointer v1, gconstpointer 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 + * + * + * 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. + * + * Since: 2.0 + */ +void +cogl_quaternion_multiply (CoglQuaternion *result, + const CoglQuaternion *left, + const CoglQuaternion *right); + +/** + * cogl_quaternion_pow: + * @quaternion: A #CoglQuaternion + * + * + * Since: 2.0 + */ +void +cogl_quaternion_pow (CoglQuaternion *quaternion, float exponent); + +/** + * cogl_quaternion_slerp: + * + * 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: + * + * + * 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); + +G_END_DECLS + +#endif /* __COGL_QUATERNION_H__ */ + diff --git a/cogl/cogl-queue.h b/cogl/cogl-queue.h new file mode 100644 index 0000000..7020ae0 --- /dev/null +++ b/cogl/cogl-queue.h @@ -0,0 +1,647 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Copyright (C) 2011 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + * $FreeBSD$ + */ + +#ifndef _COGL_QUEUE_H_ +#define _COGL_QUEUE_H_ + +/* + * This file defines four types of data structures: singly-linked lists, + * singly-linked tail queues, lists and tail queues. + * + * A singly-linked list is headed by a single forward pointer. The elements + * are singly linked for minimum space and pointer manipulation overhead at + * the expense of O(n) removal for arbitrary elements. New elements can be + * added to the list after an existing element or at the head of the list. + * Elements being removed from the head of the list should use the explicit + * macro for this purpose for optimum efficiency. A singly-linked list may + * only be traversed in the forward direction. Singly-linked lists are ideal + * for applications with large datasets and few or no removals or for + * implementing a LIFO queue. + * + * A singly-linked tail queue is headed by a pair of pointers, one to the + * head of the list and the other to the tail of the list. The elements are + * singly linked for minimum space and pointer manipulation overhead at the + * expense of O(n) removal for arbitrary elements. New elements can be added + * to the list after an existing element, at the head of the list, or at the + * end of the list. Elements being removed from the head of the tail queue + * should use the explicit macro for this purpose for optimum efficiency. + * A singly-linked tail queue may only be traversed in the forward direction. + * Singly-linked tail queues are ideal for applications with large datasets + * and few or no removals or for implementing a FIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * For details on the use of these macros, see the queue(3) manual page. + * + * + * SLIST LIST STAILQ TAILQ + * _HEAD + + + + + * _HEAD_INITIALIZER + + + + + * _ENTRY + + + + + * _INIT + + + + + * _EMPTY + + + + + * _FIRST + + + + + * _NEXT + + + + + * _PREV - - - + + * _LAST - - + + + * _FOREACH + + + + + * _FOREACH_SAFE + + + + + * _FOREACH_REVERSE - - - + + * _FOREACH_REVERSE_SAFE - - - + + * _INSERT_HEAD + + + + + * _INSERT_BEFORE - + - + + * _INSERT_AFTER + + + + + * _INSERT_TAIL - - + + + * _CONCAT - - + + + * _REMOVE_AFTER + - + - + * _REMOVE_HEAD + - + - + * _REMOVE + + + + + * _SWAP + + + + + * + */ +#ifdef COGL_QUEUE_MACRO_DEBUG +/* Store the last 2 places the queue element or head was altered */ +struct cogl_qm_trace { + char * lastfile; + int lastline; + char * prevfile; + int prevline; +}; + +#define COGL_TRACEBUF struct cogl_qm_trace trace; +#define COGL_TRASHIT(x) do {(x) = (void *)-1;} while (0) +#define COGL_QMD_SAVELINK(name, link) void **name = (void *)&(link) + +#define COGL_QMD_TRACE_HEAD(head) do { \ + (head)->trace.prevline = (head)->trace.lastline; \ + (head)->trace.prevfile = (head)->trace.lastfile; \ + (head)->trace.lastline = __LINE__; \ + (head)->trace.lastfile = __FILE__; \ +} while (0) + +#define COGL_QMD_TRACE_ELEM(elem) do { \ + (elem)->trace.prevline = (elem)->trace.lastline; \ + (elem)->trace.prevfile = (elem)->trace.lastfile; \ + (elem)->trace.lastline = __LINE__; \ + (elem)->trace.lastfile = __FILE__; \ +} while (0) + +#else +#define COGL_QMD_TRACE_ELEM(elem) +#define COGL_QMD_TRACE_HEAD(head) +#define COGL_QMD_SAVELINK(name, link) +#define COGL_TRACEBUF +#define COGL_TRASHIT(x) +#endif /* COGL_QUEUE_MACRO_DEBUG */ + +/* + * Singly-linked List declarations. + */ +#define COGL_SLIST_HEAD(name, type) \ +typedef struct _ ## name { \ + type *slh_first; /* first element */ \ +} name + +#define COGL_SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define COGL_SLIST_ENTRY(type) \ +struct { \ + type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define COGL_SLIST_EMPTY(head) ((head)->slh_first == NULL) + +#define COGL_SLIST_FIRST(head) ((head)->slh_first) + +#define COGL_SLIST_FOREACH(var, head, field) \ + for ((var) = COGL_SLIST_FIRST((head)); \ + (var); \ + (var) = COGL_SLIST_NEXT((var), field)) + +#define COGL_SLIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = COGL_SLIST_FIRST((head)); \ + (var) && ((tvar) = COGL_SLIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define COGL_SLIST_FOREACH_PREVPTR(var, varp, head, field) \ + for ((varp) = &COGL_SLIST_FIRST((head)); \ + ((var) = *(varp)) != NULL; \ + (varp) = &COGL_SLIST_NEXT((var), field)) + +#define COGL_SLIST_INIT(head) do { \ + COGL_SLIST_FIRST((head)) = NULL; \ +} while (0) + +#define COGL_SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + COGL_SLIST_NEXT((elm), field) = COGL_SLIST_NEXT((slistelm), field); \ + COGL_SLIST_NEXT((slistelm), field) = (elm); \ +} while (0) + +#define COGL_SLIST_INSERT_HEAD(head, elm, field) do { \ + COGL_SLIST_NEXT((elm), field) = COGL_SLIST_FIRST((head)); \ + COGL_SLIST_FIRST((head)) = (elm); \ +} while (0) + +#define COGL_SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define COGL_SLIST_REMOVE(head, elm, type, field) do { \ + COGL_QMD_SAVELINK(oldnext, (elm)->field.sle_next); \ + if (COGL_SLIST_FIRST((head)) == (elm)) { \ + COGL_SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + type *curelm = COGL_SLIST_FIRST((head)); \ + while (COGL_SLIST_NEXT(curelm, field) != (elm)) \ + curelm = COGL_SLIST_NEXT(curelm, field); \ + COGL_SLIST_REMOVE_AFTER(curelm, field); \ + } \ + COGL_TRASHIT(*oldnext); \ +} while (0) + +#define COGL_SLIST_REMOVE_AFTER(elm, field) do { \ + COGL_SLIST_NEXT(elm, field) = \ + COGL_SLIST_NEXT(COGL_SLIST_NEXT(elm, field), field); \ +} while (0) + +#define COGL_SLIST_REMOVE_HEAD(head, field) do { \ + COGL_SLIST_FIRST((head)) = \ + COGL_SLIST_NEXT(COGL_SLIST_FIRST((head)), field); \ +} while (0) + +#define COGL_SLIST_SWAP(head1, head2, type) do { \ + type *swap_first = COGL_SLIST_FIRST(head1); \ + COGL_SLIST_FIRST(head1) = COGL_SLIST_FIRST(head2); \ + COGL_SLIST_FIRST(head2) = swap_first; \ +} while (0) + +/* + * Singly-linked Tail queue declarations. + */ +#define COGL_STAILQ_HEAD(name, type) \ +typedef struct _ ## name { \ + type *stqh_first;/* first element */ \ + type **stqh_last;/* addr of last next element */ \ +} name + +#define COGL_STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define COGL_STAILQ_ENTRY(type) \ +struct { \ + type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define COGL_STAILQ_CONCAT(head1, head2) do { \ + if (!COGL_STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + COGL_STAILQ_INIT((head2)); \ + } \ +} while (0) + +#define COGL_STAILQ_EMPTY(head) ((head)->stqh_first == NULL) + +#define COGL_STAILQ_FIRST(head) ((head)->stqh_first) + +#define COGL_STAILQ_FOREACH(var, head, field) \ + for((var) = COGL_STAILQ_FIRST((head)); \ + (var); \ + (var) = COGL_STAILQ_NEXT((var), field)) + + +#define COGL_STAILQ_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = COGL_STAILQ_FIRST((head)); \ + (var) && ((tvar) = COGL_STAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define COGL_STAILQ_INIT(head) do { \ + COGL_STAILQ_FIRST((head)) = NULL; \ + (head)->stqh_last = &COGL_STAILQ_FIRST((head)); \ +} while (0) + +#define COGL_STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ + if ((COGL_STAILQ_NEXT((elm), field) = \ + COGL_STAILQ_NEXT((tqelm), field)) == NULL) \ + (head)->stqh_last = &COGL_STAILQ_NEXT((elm), field); \ + COGL_STAILQ_NEXT((tqelm), field) = (elm); \ +} while (0) + +#define COGL_STAILQ_INSERT_HEAD(head, elm, field) do { \ + if ((COGL_STAILQ_NEXT((elm), field) = \ + COGL_STAILQ_FIRST((head))) == NULL) \ + (head)->stqh_last = &COGL_STAILQ_NEXT((elm), field); \ + COGL_STAILQ_FIRST((head)) = (elm); \ + } while (0) + +#define COGL_STAILQ_INSERT_TAIL(head, elm, field) do { \ + COGL_STAILQ_NEXT((elm), field) = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &COGL_STAILQ_NEXT((elm), field); \ +} while (0) + +#define COGL_STAILQ_LAST(head, type, field) \ + (COGL_STAILQ_EMPTY((head)) ? \ + NULL : \ + ((type *)(void *) \ + ((char *)((head)->stqh_last) - \ + __offsetof(struct type, field)))) + +#define COGL_STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + +#define COGL_STAILQ_REMOVE(head, elm, type, field) do { \ + COGL_QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \ + if (COGL_STAILQ_FIRST((head)) == (elm)) { \ + COGL_STAILQ_REMOVE_HEAD((head), field); \ + } \ + else { \ + type *curelm = COGL_STAILQ_FIRST((head)); \ + while (COGL_STAILQ_NEXT(curelm, field) != (elm)) \ + curelm = COGL_STAILQ_NEXT(curelm, field); \ + COGL_STAILQ_REMOVE_AFTER(head, curelm, field); \ + } \ + COGL_TRASHIT(*oldnext); \ +} while (0) + +#define COGL_STAILQ_REMOVE_AFTER(head, elm, field) do { \ + if ((COGL_STAILQ_NEXT(elm, field) = \ + COGL_STAILQ_NEXT(COGL_STAILQ_NEXT(elm, field), \ + field)) == NULL) \ + (head)->stqh_last = &COGL_STAILQ_NEXT((elm), field); \ +} while (0) + +#define COGL_STAILQ_REMOVE_HEAD(head, field) do { \ + if ((COGL_STAILQ_FIRST((head)) = \ + COGL_STAILQ_NEXT(COGL_STAILQ_FIRST((head)), field)) == NULL) \ + (head)->stqh_last = &COGL_STAILQ_FIRST((head)); \ +} while (0) + +#define COGL_STAILQ_SWAP(head1, head2, type) do { \ + type *swap_first = COGL_STAILQ_FIRST(head1); \ + type **swap_last = (head1)->stqh_last; \ + COGL_STAILQ_FIRST(head1) = COGL_STAILQ_FIRST(head2); \ + (head1)->stqh_last = (head2)->stqh_last; \ + COGL_STAILQ_FIRST(head2) = swap_first; \ + (head2)->stqh_last = swap_last; \ + if (COGL_STAILQ_EMPTY(head1)) \ + (head1)->stqh_last = &COGL_STAILQ_FIRST(head1); \ + if (COGL_STAILQ_EMPTY(head2)) \ + (head2)->stqh_last = &COGL_STAILQ_FIRST(head2); \ +} while (0) + + +/* + * List declarations. + */ +#define COGL_LIST_HEAD(name, type) \ +typedef struct _ ## name { \ + type *lh_first; /* first element */ \ +} name + +#define COGL_LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define COGL_LIST_ENTRY(type) \ +struct { \ + type *le_next; /* next element */ \ + type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ + +#if (defined(_KERNEL) && defined(INVARIANTS)) +#define COGL_QMD_LIST_CHECK_HEAD(head, field) do { \ + if (COGL_LIST_FIRST((head)) != NULL && \ + COGL_LIST_FIRST((head))->field.le_prev != \ + &COGL_LIST_FIRST((head))) \ + panic("Bad list head %p first->prev != head", (head)); \ +} while (0) + +#define COGL_QMD_LIST_CHECK_NEXT(elm, field) do { \ + if (COGL_LIST_NEXT((elm), field) != NULL && \ + COGL_LIST_NEXT((elm), field)->field.le_prev != \ + &((elm)->field.le_next)) \ + panic("Bad link elm %p next->prev != elm", (elm)); \ +} while (0) + +#define COGL_QMD_LIST_CHECK_PREV(elm, field) do { \ + if (*(elm)->field.le_prev != (elm)) \ + panic("Bad link elm %p prev->next != elm", (elm)); \ +} while (0) +#else +#define COGL_QMD_LIST_CHECK_HEAD(head, field) +#define COGL_QMD_LIST_CHECK_NEXT(elm, field) +#define COGL_QMD_LIST_CHECK_PREV(elm, field) +#endif /* (_KERNEL && INVARIANTS) */ + +#define COGL_LIST_EMPTY(head) ((head)->lh_first == NULL) + +#define COGL_LIST_FIRST(head) ((head)->lh_first) + +#define COGL_LIST_FOREACH(var, head, field) \ + for ((var) = COGL_LIST_FIRST((head)); \ + (var); \ + (var) = COGL_LIST_NEXT((var), field)) + +#define COGL_LIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = COGL_LIST_FIRST((head)); \ + (var) && ((tvar) = COGL_LIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define COGL_LIST_INIT(head) do { \ + COGL_LIST_FIRST((head)) = NULL; \ +} while (0) + +#define COGL_LIST_INSERT_AFTER(listelm, elm, field) do { \ + COGL_QMD_LIST_CHECK_NEXT(listelm, field); \ + if ((COGL_LIST_NEXT((elm), field) = \ + COGL_LIST_NEXT((listelm), field)) != NULL) \ + COGL_LIST_NEXT((listelm), field)->field.le_prev = \ + &COGL_LIST_NEXT((elm), field); \ + COGL_LIST_NEXT((listelm), field) = (elm); \ + (elm)->field.le_prev = &COGL_LIST_NEXT((listelm), field); \ +} while (0) + +#define COGL_LIST_INSERT_BEFORE(listelm, elm, field) do { \ + COGL_QMD_LIST_CHECK_PREV(listelm, field); \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + COGL_LIST_NEXT((elm), field) = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &COGL_LIST_NEXT((elm), field); \ +} while (0) + +#define COGL_LIST_INSERT_HEAD(head, elm, field) do { \ + COGL_QMD_LIST_CHECK_HEAD((head), field); \ + if ((COGL_LIST_NEXT((elm), field) = \ + COGL_LIST_FIRST((head))) != NULL) \ + COGL_LIST_FIRST((head))->field.le_prev = \ + &COGL_LIST_NEXT((elm), field); \ + COGL_LIST_FIRST((head)) = (elm); \ + (elm)->field.le_prev = &COGL_LIST_FIRST((head)); \ +} while (0) + +#define COGL_LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define COGL_LIST_REMOVE(elm, field) do { \ + COGL_QMD_SAVELINK(oldnext, (elm)->field.le_next); \ + COGL_QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ + COGL_QMD_LIST_CHECK_NEXT(elm, field); \ + COGL_QMD_LIST_CHECK_PREV(elm, field); \ + if (COGL_LIST_NEXT((elm), field) != NULL) \ + COGL_LIST_NEXT((elm), field)->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = COGL_LIST_NEXT((elm), field); \ + COGL_TRASHIT(*oldnext); \ + COGL_TRASHIT(*oldprev); \ +} while (0) + +#define COGL_LIST_SWAP(head1, head2, type, field) do { \ + type *swap_tmp = COGL_LIST_FIRST((head1)); \ + COGL_LIST_FIRST((head1)) = COGL_LIST_FIRST((head2)); \ + COGL_LIST_FIRST((head2)) = swap_tmp; \ + if ((swap_tmp = COGL_LIST_FIRST((head1))) != NULL) \ + swap_tmp->field.le_prev = &COGL_LIST_FIRST((head1)); \ + if ((swap_tmp = COGL_LIST_FIRST((head2))) != NULL) \ + swap_tmp->field.le_prev = &COGL_LIST_FIRST((head2)); \ +} while (0) + +/* + * Tail queue declarations. + */ +#define COGL_TAILQ_HEAD(name, type) \ +typedef struct _ ## name { \ + type *tqh_first; /* first element */ \ + type **tqh_last; /* addr of last next element */ \ + COGL_TRACEBUF \ +} name + +#define COGL_TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define COGL_TAILQ_ENTRY(type) \ +struct { \ + type *tqe_next; /* next element */ \ + type **tqe_prev; /* address of previous next element */ \ + COGL_TRACEBUF \ +} + +/* + * Tail queue functions. + */ +#if (defined(_KERNEL) && defined(INVARIANTS)) +#define COGL_QMD_TAILQ_CHECK_HEAD(head, field) do { \ + if (!COGL_TAILQ_EMPTY(head) && \ + COGL_TAILQ_FIRST((head))->field.tqe_prev != \ + &COGL_TAILQ_FIRST((head))) \ + panic("Bad tailq head %p first->prev != head", (head)); \ +} while (0) + +#define COGL_QMD_TAILQ_CHECK_TAIL(head, field) do { \ + if (*(head)->tqh_last != NULL) \ + panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ +} while (0) + +#define COGL_QMD_TAILQ_CHECK_NEXT(elm, field) do { \ + if (COGL_TAILQ_NEXT((elm), field) != NULL && \ + COGL_TAILQ_NEXT((elm), field)->field.tqe_prev != \ + &((elm)->field.tqe_next)) \ + panic("Bad link elm %p next->prev != elm", (elm)); \ +} while (0) + +#define COGL_QMD_TAILQ_CHECK_PREV(elm, field) do { \ + if (*(elm)->field.tqe_prev != (elm)) \ + panic("Bad link elm %p prev->next != elm", (elm)); \ +} while (0) +#else +#define COGL_QMD_TAILQ_CHECK_HEAD(head, field) +#define COGL_QMD_TAILQ_CHECK_TAIL(head, headname) +#define COGL_QMD_TAILQ_CHECK_NEXT(elm, field) +#define COGL_QMD_TAILQ_CHECK_PREV(elm, field) +#endif /* (_KERNEL && INVARIANTS) */ + +#define COGL_TAILQ_CONCAT(head1, head2, field) do { \ + if (!COGL_TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + COGL_TAILQ_INIT((head2)); \ + COGL_QMD_TRACE_HEAD(head1); \ + COGL_QMD_TRACE_HEAD(head2); \ + } \ +} while (0) + +#define COGL_TAILQ_EMPTY(head) ((head)->tqh_first == NULL) + +#define COGL_TAILQ_FIRST(head) ((head)->tqh_first) + +#define COGL_TAILQ_FOREACH(var, head, field) \ + for ((var) = COGL_TAILQ_FIRST((head)); \ + (var); \ + (var) = COGL_TAILQ_NEXT((var), field)) + +#define COGL_TAILQ_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = COGL_TAILQ_FIRST((head)); \ + (var) && ((tvar) = COGL_TAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define COGL_TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = COGL_TAILQ_LAST((head), headname); \ + (var); \ + (var) = COGL_TAILQ_PREV((var), headname, field)) + +#define COGL_TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ + for ((var) = COGL_TAILQ_LAST((head), headname); \ + (var) && ((tvar) = COGL_TAILQ_PREV((var), headname, field), 1); \ + (var) = (tvar)) + +#define COGL_TAILQ_INIT(head) do { \ + COGL_TAILQ_FIRST((head)) = NULL; \ + (head)->tqh_last = &COGL_TAILQ_FIRST((head)); \ + COGL_QMD_TRACE_HEAD(head); \ +} while (0) + +#define COGL_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + COGL_QMD_TAILQ_CHECK_NEXT(listelm, field); \ + if ((COGL_TAILQ_NEXT((elm), field) = \ + COGL_TAILQ_NEXT((listelm), field)) != NULL) \ + COGL_TAILQ_NEXT((elm), field)->field.tqe_prev = \ + &COGL_TAILQ_NEXT((elm), field); \ + else { \ + (head)->tqh_last = &COGL_TAILQ_NEXT((elm), field); \ + COGL_QMD_TRACE_HEAD(head); \ + } \ + COGL_TAILQ_NEXT((listelm), field) = (elm); \ + (elm)->field.tqe_prev = &COGL_TAILQ_NEXT((listelm), field); \ + COGL_QMD_TRACE_ELEM(&(elm)->field); \ + COGL_QMD_TRACE_ELEM(&listelm->field); \ +} while (0) + +#define COGL_TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + COGL_QMD_TAILQ_CHECK_PREV(listelm, field); \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + COGL_TAILQ_NEXT((elm), field) = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &COGL_TAILQ_NEXT((elm), field); \ + COGL_QMD_TRACE_ELEM(&(elm)->field); \ + COGL_QMD_TRACE_ELEM(&listelm->field); \ +} while (0) + +#define COGL_TAILQ_INSERT_HEAD(head, elm, field) do { \ + COGL_QMD_TAILQ_CHECK_HEAD(head, field); \ + if ((COGL_TAILQ_NEXT((elm), field) = \ + COGL_TAILQ_FIRST((head))) != NULL) \ + COGL_TAILQ_FIRST((head))->field.tqe_prev = \ + &COGL_TAILQ_NEXT((elm), field); \ + else \ + (head)->tqh_last = &COGL_TAILQ_NEXT((elm), field); \ + COGL_TAILQ_FIRST((head)) = (elm); \ + (elm)->field.tqe_prev = &COGL_TAILQ_FIRST((head)); \ + COGL_QMD_TRACE_HEAD(head); \ + COGL_QMD_TRACE_ELEM(&(elm)->field); \ +} while (0) + +#define COGL_TAILQ_INSERT_TAIL(head, elm, field) do { \ + COGL_QMD_TAILQ_CHECK_TAIL(head, field); \ + COGL_TAILQ_NEXT((elm), field) = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &COGL_TAILQ_NEXT((elm), field); \ + COGL_QMD_TRACE_HEAD(head); \ + COGL_QMD_TRACE_ELEM(&(elm)->field); \ +} while (0) + +#define COGL_TAILQ_LAST(head, headname) \ + (*(((headname *)((head)->tqh_last))->tqh_last)) + +#define COGL_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define COGL_TAILQ_PREV(elm, headname, field) \ + (*(((headname *)((elm)->field.tqe_prev))->tqh_last)) + +#define COGL_TAILQ_REMOVE(head, elm, field) do { \ + COGL_QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ + COGL_QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ + COGL_QMD_TAILQ_CHECK_NEXT(elm, field); \ + COGL_QMD_TAILQ_CHECK_PREV(elm, field); \ + if ((COGL_TAILQ_NEXT((elm), field)) != NULL) \ + COGL_TAILQ_NEXT((elm), field)->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else { \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + COGL_QMD_TRACE_HEAD(head); \ + } \ + *(elm)->field.tqe_prev = COGL_TAILQ_NEXT((elm), field); \ + COGL_TRASHIT(*oldnext); \ + COGL_TRASHIT(*oldprev); \ + COGL_QMD_TRACE_ELEM(&(elm)->field); \ +} while (0) + +#define COGL_TAILQ_SWAP(head1, head2, type, field) do { \ + type *swap_first = (head1)->tqh_first; \ + type **swap_last = (head1)->tqh_last; \ + (head1)->tqh_first = (head2)->tqh_first; \ + (head1)->tqh_last = (head2)->tqh_last; \ + (head2)->tqh_first = swap_first; \ + (head2)->tqh_last = swap_last; \ + if ((swap_first = (head1)->tqh_first) != NULL) \ + swap_first->field.tqe_prev = &(head1)->tqh_first; \ + else \ + (head1)->tqh_last = &(head1)->tqh_first; \ + if ((swap_first = (head2)->tqh_first) != NULL) \ + swap_first->field.tqe_prev = &(head2)->tqh_first; \ + else \ + (head2)->tqh_last = &(head2)->tqh_first; \ +} while (0) + +#endif /* !_COGL_QUEUE_H_ */ diff --git a/cogl/cogl-rectangle-map.c b/cogl/cogl-rectangle-map.c new file mode 100644 index 0000000..a483a56 --- /dev/null +++ b/cogl/cogl-rectangle-map.c @@ -0,0 +1,757 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + * + * 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 */ + gboolean 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, + gboolean 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 */ + +gboolean +_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..51b9260 --- /dev/null +++ b/cogl/cogl-rectangle-map.h @@ -0,0 +1,78 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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 __COGL_RECTANGLE_MAP_H +#define __COGL_RECTANGLE_MAP_H + +#include + +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); + +gboolean +_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..11dc0bb --- /dev/null +++ b/cogl/cogl-renderer-private.h @@ -0,0 +1,91 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_RENDERER_PRIVATE_H +#define __COGL_RENDERER_PRIVATE_H + +#include + +#include "cogl-object-private.h" +#include "cogl-winsys-private.h" +#include "cogl-internal.h" + +#ifdef COGL_HAS_XLIB_SUPPORT +#include +#endif + +#if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) +#include +#endif + +struct _CoglRenderer +{ + CoglObject _parent; + gboolean connected; + CoglDriver driver_override; + const CoglWinsysVtable *winsys_vtable; + CoglWinsysID winsys_id_override; + GList *constraints; + +#ifdef COGL_HAS_XLIB_SUPPORT + Display *foreign_xdpy; + gboolean xlib_enable_event_retrieval; +#endif + + CoglDriver driver; +#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY + GModule *libgl_module; +#endif + +#if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) + struct wl_display *foreign_wayland_display; + struct wl_compositor *foreign_wayland_compositor; + struct wl_shell *foreign_wayland_shell; +#endif + /* List of callback functions that will be given every native event */ + GSList *event_filters; + void *winsys; +}; + +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); + +#endif /* __COGL_RENDERER_PRIVATE_H */ diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c new file mode 100644 index 0000000..d07a3ca --- /dev/null +++ b/cogl/cogl-renderer.c @@ -0,0 +1,527 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "cogl-util.h" +#include "cogl-internal.h" +#include "cogl-private.h" +#include "cogl-object.h" +#include "cogl-context-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" + +#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 + +#if COGL_HAS_XLIB_SUPPORT +#include "cogl-xlib-renderer.h" +#endif + +typedef const CoglWinsysVtable *(*CoglWinsysVtableGetter) (void); + +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); + +typedef struct _CoglNativeFilterClosure +{ + CoglNativeFilterFunc func; + void *data; +} CoglNativeFilterClosure; + +GQuark +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); + 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_free (renderer); +} + +CoglRenderer * +cogl_renderer_new (void) +{ + CoglRenderer *renderer = g_new0 (CoglRenderer, 1); + + _cogl_init (); + + renderer->connected = FALSE; + renderer->event_filters = NULL; + +#ifdef COGL_HAS_XLIB_SUPPORT + renderer->xlib_enable_event_retrieval = TRUE; +#endif + + return _cogl_renderer_object_new (renderer); +} + +#if 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, + gboolean 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 */ + +gboolean +cogl_renderer_check_onscreen_template (CoglRenderer *renderer, + CoglOnscreenTemplate *onscreen_template, + GError **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; +} + +static gboolean +_cogl_renderer_choose_driver (CoglRenderer *renderer, + GError **error) +{ + const char *driver_name = g_getenv ("COGL_DRIVER"); + const char *libgl_name; + + if (!driver_name) + driver_name = _cogl_config_driver; + +#ifdef HAVE_COGL_GL + if (renderer->driver_override == COGL_DRIVER_GL || + (renderer->driver_override == COGL_DRIVER_ANY && + (driver_name == NULL || !g_ascii_strcasecmp (driver_name, "gl")))) + { + renderer->driver = COGL_DRIVER_GL; + libgl_name = COGL_GL_LIBNAME; + goto found; + } +#endif + +#ifdef HAVE_COGL_GLES2 + if (renderer->driver_override == COGL_DRIVER_GLES2 || + (renderer->driver_override == COGL_DRIVER_ANY && + (driver_name == NULL || !g_ascii_strcasecmp (driver_name, "gles2")))) + { + renderer->driver = COGL_DRIVER_GLES2; + libgl_name = COGL_GLES2_LIBNAME; + goto found; + } +#endif + +#ifdef HAVE_COGL_GLES + if (renderer->driver_override == COGL_DRIVER_GLES1 || + (renderer->driver_override == COGL_DRIVER_ANY && + (driver_name == NULL || !g_ascii_strcasecmp (driver_name, "gles1")))) + { + renderer->driver = COGL_DRIVER_GLES1; + libgl_name = COGL_GLES1_LIBNAME; + goto found; + } +#endif + + g_set_error (error, + COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND, + "No suitable driver found"); + return FALSE; + + found: + +#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY + + renderer->libgl_module = g_module_open (libgl_name, + G_MODULE_BIND_LAZY); + + if (renderer->libgl_module == NULL) + { + g_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 */ + +gboolean +cogl_renderer_connect (CoglRenderer *renderer, GError **error) +{ + int i; + GString *error_message; + + 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](); + GError *tmp_error = NULL; + GList *l; + gboolean constraints_failed = 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)) + { + constraints_failed = TRUE; + break; + } + } + if (constraints_failed) + 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); + g_error_free (tmp_error); + } + else + { + renderer->connected = TRUE; + g_string_free (error_message, TRUE); + return TRUE; + } + } + + if (!renderer->connected) + { + renderer->winsys_vtable = NULL; + g_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) +{ + const CoglWinsysVtable *winsys = _cogl_renderer_get_winsys (renderer); + + return winsys->renderer_get_proc_address (renderer, name); +} + +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 (ctx->driver == COGL_DRIVER_GL || ctx->driver == COGL_DRIVER_GLES2) + 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; +} diff --git a/cogl/cogl-renderer.h b/cogl/cogl-renderer.h new file mode 100644 index 0000000..6332327 --- /dev/null +++ b/cogl/cogl-renderer.h @@ -0,0 +1,381 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_RENDERER_H__ +#define __COGL_RENDERER_H__ + +#include + +#include +#include + +G_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 () + +GQuark +cogl_renderer_error_quark (void); + +typedef struct _CoglRenderer CoglRenderer; + +/** + * 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 + */ +gboolean +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_criteria(). + * + * 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. + * + * 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 #GError 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 + */ +gboolean +cogl_renderer_check_onscreen_template (CoglRenderer *renderer, + CoglOnscreenTemplate *onscreen_template, + GError **error); + +/* Final connection API */ + +/** + * cogl_renderer_connect: + * @renderer: An unconnected #CoglRenderer + * @error a pointer to a #GError 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 + */ +gboolean +cogl_renderer_connect (CoglRenderer *renderer, GError **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 + * + * 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) +} 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_GL: An OpenGL driver. + * @COGL_DRIVER_GLES1: An OpenGL ES 1.1 driver. + * @COGL_DRIVER_GLES2: An OpenGL ES 2.0 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_GL, + COGL_DRIVER_GLES1, + COGL_DRIVER_GLES2 +} 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); + +G_END_DECLS + +#endif /* __COGL_RENDERER_H__ */ + diff --git a/cogl/cogl-shader-boilerplate.h b/cogl/cogl-shader-boilerplate.h new file mode 100644 index 0000000..e5a86d8 --- /dev/null +++ b/cogl/cogl-shader-boilerplate.h @@ -0,0 +1,119 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_SHADER_BOILERPLATE_H +#define __COGL_SHADER_BOILERPLATE_H + + +#define _COGL_COMMON_SHADER_BOILERPLATE_GL \ + "#define COGL_VERSION 100\n" \ + "\n" \ + "#define cogl_modelview_matrix gl_ModelViewMatrix\n" \ + "#define cogl_modelview_projection_matrix gl_ModelViewProjectionMatrix\n" \ + "#define cogl_projection_matrix gl_ProjectionMatrix\n" \ + "#define cogl_texture_matrix gl_TextureMatrix\n" \ + "\n" + +#define _COGL_VERTEX_SHADER_BOILERPLATE_GL \ + _COGL_COMMON_SHADER_BOILERPLATE_GL \ + "#define cogl_position_in gl_Vertex\n" \ + "#define cogl_color_in gl_Color\n" \ + "#define cogl_tex_coord_in gl_MultiTexCoord0\n" \ + "#define cogl_tex_coord0_in gl_MultiTexCoord0\n" \ + "#define cogl_tex_coord1_in gl_MultiTexCoord1\n" \ + "#define cogl_tex_coord2_in gl_MultiTexCoord2\n" \ + "#define cogl_tex_coord3_in gl_MultiTexCoord3\n" \ + "#define cogl_tex_coord4_in gl_MultiTexCoord4\n" \ + "#define cogl_tex_coord5_in gl_MultiTexCoord5\n" \ + "#define cogl_tex_coord6_in gl_MultiTexCoord6\n" \ + "#define cogl_tex_coord7_in gl_MultiTexCoord7\n" \ + "#define cogl_normal_in gl_Normal\n" \ + "\n" \ + "#define cogl_position_out gl_Position\n" \ + "#define cogl_point_size_out gl_PointSize\n" \ + "#define cogl_color_out gl_FrontColor\n" \ + "#define cogl_tex_coord_out gl_TexCoord\n" + +#define _COGL_FRAGMENT_SHADER_BOILERPLATE_GL \ + _COGL_COMMON_SHADER_BOILERPLATE_GL \ + "#define cogl_color_in gl_Color\n" \ + "#define cogl_tex_coord_in gl_TexCoord\n" \ + "\n" \ + "#define cogl_color_out gl_FragColor\n" \ + "#define cogl_depth_out gl_FragDepth\n" \ + "\n" \ + "#define cogl_front_facing gl_FrontFacing\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 + +#define _COGL_COMMON_SHADER_BOILERPLATE_GLES2 \ + "#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" \ + "uniform float cogl_point_size_in;\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 for GLES at least + implies that this will happen for varyings but it doesn't + explicitly so for attributes */ +#define _COGL_VERTEX_SHADER_BOILERPLATE_GLES2 \ + _COGL_COMMON_SHADER_BOILERPLATE_GLES2 \ + "#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_GLES2 \ + "#if __VERSION__ == 100\n" \ + "precision highp float;\n" \ + "#endif\n" \ + _COGL_COMMON_SHADER_BOILERPLATE_GLES2 \ + "\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" + +#endif /* __COGL_SHADER_BOILERPLATE_H */ + diff --git a/cogl/cogl-shader-private.h b/cogl/cogl-shader-private.h new file mode 100644 index 0000000..6c05b3f --- /dev/null +++ b/cogl/cogl-shader-private.h @@ -0,0 +1,62 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_SHADER_H +#define __COGL_SHADER_H + +#include "cogl-handle.h" +#include "cogl-shader.h" + +typedef struct _CoglShader CoglShader; + +typedef enum +{ + COGL_SHADER_LANGUAGE_GLSL, + COGL_SHADER_LANGUAGE_ARBFP +} CoglShaderLanguage; + +struct _CoglShader +{ + CoglHandleObject _parent; + GLuint gl_handle; + int n_tex_coord_attribs; + CoglShaderType type; + CoglShaderLanguage language; + char *source; +}; + +void +_cogl_shader_compile_real (CoglHandle handle, int n_tex_coord_attribs); + +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/cogl-shader.c b/cogl/cogl-shader.c new file mode 100644 index 0000000..c80020e --- /dev/null +++ b/cogl/cogl-shader.c @@ -0,0 +1,505 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-shader-private.h" +#include "cogl-shader-boilerplate.h" +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-handle.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; +#ifdef HAVE_COGL_GLES2 + shader->n_tex_coord_attribs = 0; +#endif + 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; +} + +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 = handle; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!cogl_is_shader (handle)) + return; + + if (ctx->driver == COGL_DRIVER_GL) + _cogl_shader_compile_real (shader, 0 /* ignored */); + + /* XXX: For GLES2 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_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) +{ + const char *vertex_boilerplate; + const char *fragment_boilerplate; + + const char **strings = g_alloca (sizeof (char *) * (count_in + 3)); + GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 3)); + int count = 0; + char *tex_coord_declarations = NULL; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->driver == COGL_DRIVER_GLES2) + { + vertex_boilerplate = _COGL_VERTEX_SHADER_BOILERPLATE_GLES2; + fragment_boilerplate = _COGL_FRAGMENT_SHADER_BOILERPLATE_GLES2; + } + else + { + vertex_boilerplate = _COGL_VERTEX_SHADER_BOILERPLATE_GL; + fragment_boilerplate = _COGL_FRAGMENT_SHADER_BOILERPLATE_GL; + } + + if (ctx->driver == COGL_DRIVER_GLES2 && + 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); + } + + if (ctx->driver == COGL_DRIVER_GLES2 && + n_tex_coord_attribs) + { + GString *declarations = g_string_new (NULL); + + g_string_append_printf (declarations, + "varying vec4 _cogl_tex_coord[%d];\n", + n_tex_coord_attribs); + + if (shader_gl_type == GL_VERTEX_SHADER) + { + int i; + + g_string_append_printf (declarations, + "uniform mat4 cogl_texture_matrix[%d];\n", + n_tex_coord_attribs); + + for (i = 0; i < n_tex_coord_attribs; i++) + g_string_append_printf (declarations, + "attribute vec4 cogl_tex_coord%d_in;\n", + i); + } + + tex_coord_declarations = g_string_free (declarations, FALSE); + strings[count] = tex_coord_declarations; + 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 (tex_coord_declarations); +} + +void +_cogl_shader_compile_real (CoglHandle handle, + int n_tex_coord_attribs) +{ + 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; + + if (shader->gl_handle +#ifdef HAVE_COGL_GLES2 + && + (ctx->driver != COGL_DRIVER_GLES2 || + shader->n_tex_coord_attribs == n_tex_coord_attribs) +#endif + ) + 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_shader_set_source_with_boilerplate (shader->gl_handle, + gl_type, + n_tex_coord_attribs, + 1, + (const char **) &shader->source, + NULL); + + GE (ctx, glCompileShader (shader->gl_handle)); + +#ifdef HAVE_COGL_GLES2 + shader->n_tex_coord_attribs = n_tex_coord_attribs; +#endif + +#ifdef COGL_GL_DEBUG + if (!cogl_shader_is_compiled (handle)) + { + char *log = cogl_shader_get_info_log (handle); + g_warning ("Failed to compile GLSL program:\nsrc:\n%s\nerror:\n%s\n", + shader->source, + log); + g_free (log); + } +#endif + } +} + +char * +cogl_shader_get_info_log (CoglHandle handle) +{ + CoglShader *shader; + + _COGL_GET_CONTEXT (ctx, NULL); + + if (!cogl_is_shader (handle)) + return NULL; + + shader = handle; + +#ifdef HAVE_COGL_GL + if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) + { + /* ARBfp exposes a program error string, but since cogl_program + * doesn't have any API to query an error log it is not currently + * exposed. */ + return g_strdup (""); + } + else +#endif + { + char buffer[512]; + int len = 0; + + /* We don't normally compile the shader when the user calls + * cogl_shader_compile() because we want to be able to add + * boilerplate code that depends on how it ends up finally being + * used. + * + * Here we force an early compile if the user is interested in + * log information to increase the chance that the log will be + * useful! We have to guess the number of texture coordinate + * attributes that may be used since that affects the + * boilerplate. We use four so that the shader will still + * compile if the user is using more than one + * layer. Unfortunately this is likely to end up causing it to + * be compiled again when we know the actual number of layers */ + if (!shader->gl_handle) + _cogl_shader_compile_real (handle, 4); + + ctx->glGetShaderInfoLog (shader->gl_handle, 511, &len, buffer); + buffer[len] = '\0'; + return g_strdup (buffer); + } +} + +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; +} + +gboolean +cogl_shader_is_compiled (CoglHandle handle) +{ +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2) + GLint status; + CoglShader *shader; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (!cogl_is_shader (handle)) + return FALSE; + + shader = handle; + +#ifdef HAVE_COGL_GL + if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) + return TRUE; + else +#endif + { + /* FIXME: We currently have an arbitrary limit of 4 texture + * coordinate attributes since our API means we have to add + * some boilerplate to the users GLSL program (for GLES2) + * before we actually know how many attributes are in use. + * + * 4 will probably be enough (or at least that limitation should + * be enough until we can replace this API with the pipeline + * snippets API) but if it isn't then the shader won't compile, + * through no fault of the user. + * + * To some extent this is just a symptom of bad API design; it + * was a mistake for Cogl to so thinly wrap the OpenGL shader + * API. Eventually we plan for this whole API will be deprecated + * by the pipeline snippets framework. + */ + if (!shader->gl_handle) + _cogl_shader_compile_real (handle, 4); + + GE (ctx, glGetShaderiv (shader->gl_handle, GL_COMPILE_STATUS, &status)); + if (status == GL_TRUE) + return TRUE; + else + return FALSE; + } +#else + return FALSE; +#endif +} diff --git a/cogl/cogl-shader.h b/cogl/cogl-shader.h new file mode 100644 index 0000000..c9aad74 --- /dev/null +++ b/cogl/cogl-shader.h @@ -0,0 +1,654 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SHADER_H__ +#define __COGL_SHADER_H__ + +#include +#include + +G_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. + */ +CoglHandle +cogl_create_shader (CoglShaderType shader_type); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * cogl_shader_ref: + * @handle: A #CoglHandle to a shader. + * + * Add an extra reference to a shader. + * + * Deprecated: 1.0: Please use cogl_handle_ref() instead. + * + * Returns: @handle + */ +CoglHandle +cogl_shader_ref (CoglHandle handle) G_GNUC_DEPRECATED; + +/** + * 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.0: Please use cogl_handle_unref() instead. + */ +void +cogl_shader_unref (CoglHandle handle) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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 + */ +gboolean +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. + */ +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. + */ +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 + */ +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 + */ +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 + */ +gboolean +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. + */ +CoglHandle +cogl_create_program (void); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * cogl_program_ref: + * @handle: A #CoglHandle to a program. + * + * Add an extra reference to a program. + * + * Deprecated: 1.0: Please use cogl_handle_ref() instead. + * + * Returns: @handle + */ +CoglHandle +cogl_program_ref (CoglHandle handle) G_GNUC_DEPRECATED; + +/** + * 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.0: Please use cogl_handle_unref() instead. + */ +void +cogl_program_unref (CoglHandle handle) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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 + */ +gboolean +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. + */ +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. + */ +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(). + */ +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. + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +void +cogl_program_set_uniform_matrix (CoglHandle program, + int uniform_location, + int dimensions, + int count, + gboolean transpose, + const float *value); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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.4: Use cogl_program_set_uniform_1f() instead. + */ +void +cogl_program_uniform_1f (int uniform_no, + float value) G_GNUC_DEPRECATED; + +/** + * 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.4: Use cogl_program_set_uniform_1i() instead. + */ +void +cogl_program_uniform_1i (int uniform_no, + int value) G_GNUC_DEPRECATED; + +/** + * 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.4: Use cogl_program_set_uniform_float() instead. + */ +void +cogl_program_uniform_float (int uniform_no, + int size, + int count, + const float *value) G_GNUC_DEPRECATED; + +/** + * 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. + */ +void +cogl_program_uniform_int (int uniform_no, + int size, + int count, + const int *value) G_GNUC_DEPRECATED; + +/** + * 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. + */ +void +cogl_program_uniform_matrix (int uniform_no, + int size, + int count, + gboolean transpose, + const float *value) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +G_END_DECLS + +#endif /* __COGL_SHADER_H__ */ diff --git a/cogl/cogl-snippet-private.h b/cogl/cogl-snippet-private.h new file mode 100644 index 0000000..519738b --- /dev/null +++ b/cogl/cogl-snippet-private.h @@ -0,0 +1,71 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * 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. */ + gboolean 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..0af6473 --- /dev/null +++ b/cogl/cogl-snippet.c @@ -0,0 +1,178 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-snippet-private.h" +#include "cogl-util.h" + +static void +_cogl_snippet_free (CoglSnippet *snippet); + +COGL_OBJECT_DEFINE (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 gboolean +_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..88a49d2 --- /dev/null +++ b/cogl/cogl-snippet.h @@ -0,0 +1,756 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SNIPPET_H__ +#define __COGL_SNIPPET_H__ + +#include + +G_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 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. + * + * + * + * + * 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) + +/* Enumeration of all the hook points that a snippet can be attached + to within a pipeline. */ +/** + * CoglSnippetHook: + * @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_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 + * + * + * 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_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, + + /* Per pipeline fragment hooks */ + COGL_SNIPPET_HOOK_FRAGMENT = 2048, + + /* 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: + * @handle: A CoglHandle + * + * Gets whether the given handle references an existing snippet object. + * + * Return value: %TRUE if the handle references a #CoglSnippet, + * %FALSE otherwise + * + * Since: 1.10 + * Stability: Unstable + */ +gboolean +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); + +G_END_DECLS + +#endif /* __COGL_SNIPPET_H__ */ diff --git a/cogl/cogl-spans.c b/cogl/cogl-spans.c new file mode 100644 index 0000000..d1fcff9 --- /dev/null +++ b/cogl/cogl-spans.c @@ -0,0 +1,177 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "math.h" + +#include "cogl-util.h" +#include "cogl-internal.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); +} + +gboolean +_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..ac8d13a --- /dev/null +++ b/cogl/cogl-spans.h @@ -0,0 +1,74 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_SPANS_PRIVATE_H +#define __COGL_SPANS_PRIVATE_H + +#include "cogl-handle.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; + gboolean intersects; + gboolean 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); + +gboolean +_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..3b66e3b --- /dev/null +++ b/cogl/cogl-sub-texture-private.h @@ -0,0 +1,57 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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 region represented by this sub-texture. This is the region of + full_texture which won't necessarily be the same as the region + passed to _cogl_sub_texture_new if next_texture is actually + already a sub texture */ + int sub_x; + int sub_y; + int sub_width; + int sub_height; +}; + +#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..925a878 --- /dev/null +++ b/cogl/cogl-sub-texture.c @@ -0,0 +1,449 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009,2010,2011 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-internal.h" +#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 +#include + +static void _cogl_sub_texture_free (CoglSubTexture *sub_tex); + +COGL_TEXTURE_DEFINE (SubTexture, sub_texture); + +static const CoglTextureVtable cogl_sub_texture_vtable; + +static void +_cogl_sub_texture_unmap_quad (CoglSubTexture *sub_tex, + float *coords) +{ + /* 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) / sub_tex->sub_width; + coords[1] = (coords[1] - sub_tex->sub_y) / sub_tex->sub_height; + coords[2] = (coords[2] - sub_tex->sub_x) / sub_tex->sub_width; + coords[3] = (coords[3] - sub_tex->sub_y) / sub_tex->sub_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) / sub_tex->sub_width; + coords[1] = (coords[1] * height - sub_tex->sub_y) / sub_tex->sub_height; + coords[2] = (coords[2] * width - sub_tex->sub_x) / sub_tex->sub_width; + coords[3] = (coords[3] * height - sub_tex->sub_y) / sub_tex->sub_height; + } +} + +static void +_cogl_sub_texture_map_quad (CoglSubTexture *sub_tex, + float *coords) +{ + /* 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] * sub_tex->sub_width + sub_tex->sub_x; + coords[1] = coords[1] * sub_tex->sub_height + sub_tex->sub_y; + coords[2] = coords[2] * sub_tex->sub_width + sub_tex->sub_x; + coords[3] = coords[3] * sub_tex->sub_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] * sub_tex->sub_width + sub_tex->sub_x) / width; + coords[1] = (coords[1] * sub_tex->sub_height + sub_tex->sub_y) / height; + coords[2] = (coords[2] * sub_tex->sub_width + sub_tex->sub_x) / width; + coords[3] = (coords[3] * sub_tex->sub_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_set_wrap_mode_parameters (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + _cogl_texture_set_wrap_mode_parameters (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, &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; + sub_tex->sub_width = sub_width; + sub_tex->sub_height = sub_height; + + return _cogl_sub_texture_handle_new (sub_tex); +} + +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 gboolean +_cogl_sub_texture_is_sliced (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return cogl_texture_is_sliced (sub_tex->full_texture); +} + +static gboolean +_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 (sub_tex->sub_width == + cogl_texture_get_width (sub_tex->full_texture) && + sub_tex->sub_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 * sub_tex->sub_width + sub_tex->sub_x) / + cogl_texture_get_width (sub_tex->full_texture)); + *t = ((*t * sub_tex->sub_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 gboolean +_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_set_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + _cogl_texture_set_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 gboolean +_cogl_sub_texture_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return cogl_texture_set_region_from_bitmap (sub_tex->full_texture, + src_x, src_y, + dst_x + sub_tex->sub_x, + dst_y + sub_tex->sub_y, + dst_width, dst_height, + bmp); +} + +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_get_gl_format (sub_tex->full_texture); +} + +static int +_cogl_sub_texture_get_width (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return sub_tex->sub_width; +} + +static int +_cogl_sub_texture_get_height (CoglTexture *tex) +{ + CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); + + return sub_tex->sub_height; +} + +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 = + { + _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_set_filters, + _cogl_sub_texture_pre_paint, + _cogl_sub_texture_ensure_non_quad_rendering, + _cogl_sub_texture_set_wrap_mode_parameters, + _cogl_sub_texture_get_format, + _cogl_sub_texture_get_gl_format, + _cogl_sub_texture_get_width, + _cogl_sub_texture_get_height, + _cogl_sub_texture_get_type, + NULL /* is_foreign */ + }; diff --git a/cogl/cogl-sub-texture.h b/cogl/cogl-sub-texture.h new file mode 100644 index 0000000..6dae9ae --- /dev/null +++ b/cogl/cogl-sub-texture.h @@ -0,0 +1,126 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SUB_TEXTURE_H +#define __COGL_SUB_TEXTURE_H + +#include + +G_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; + +#define cogl_sub_texture_new cogl_sub_texture_new_EXP +/** + * cogl_sub_texture_new: + * @context: 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. + * + * Returns: 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); + +#define cogl_is_sub_texture cogl_is_sub_texture_EXP +/** + * 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 + */ +gboolean +cogl_is_sub_texture (void *object); + +G_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..2f63109 --- /dev/null +++ b/cogl/cogl-swap-chain-private.h @@ -0,0 +1,38 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_SWAP_CHAIN_PRIVATE_H +#define __COGL_SWAP_CHAIN_PRIVATE_H + +#include "cogl-object-private.h" + +struct _CoglSwapChain +{ + CoglObject _parent; + + gboolean 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..51609fe --- /dev/null +++ b/cogl/cogl-swap-chain.c @@ -0,0 +1,68 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * 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" + +static void _cogl_swap_chain_free (CoglSwapChain *swap_chain); + +COGL_OBJECT_DEFINE (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, + gboolean 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..0420935 --- /dev/null +++ b/cogl/cogl-swap-chain.h @@ -0,0 +1,54 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_SWAP_CHAIN_H__ +#define __COGL_SWAP_CHAIN_H__ + +G_BEGIN_DECLS + +typedef struct _CoglSwapChain CoglSwapChain; + +#define cogl_swap_chain_new cogl_swap_chain_new_EXP +CoglSwapChain * +cogl_swap_chain_new (void); + +#define cogl_swap_chain_set_has_alpha cogl_swap_chain_set_has_alpha_EXP +void +cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain, + gboolean has_alpha); + +#define cogl_swap_chain_set_length cogl_swap_chain_set_length_EXP +void +cogl_swap_chain_set_length (CoglSwapChain *swap_chain, + int length); + +gboolean +cogl_is_swap_chain (void *object); + +G_END_DECLS + +#endif /* __COGL_SWAP_CHAIN_H__ */ diff --git a/cogl/cogl-texture-2d-private.h b/cogl/cogl-texture-2d-private.h new file mode 100644 index 0000000..b19c6ea --- /dev/null +++ b/cogl/cogl-texture-2d-private.h @@ -0,0 +1,108 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_TEXTURE_2D_H +#define __COGL_TEXTURE_2D_H + +#include "cogl-handle.h" +#include "cogl-pipeline-private.h" +#include "cogl-texture-private.h" +#include "cogl-texture-2d.h" + +struct _CoglTexture2D +{ + CoglTexture _parent; + + /* The internal format of the GL texture represented as a + CoglPixelFormat */ + CoglPixelFormat format; + /* The internal format of the GL texture represented as a GL enum */ + GLenum gl_format; + /* The texture object number */ + GLuint gl_texture; + int width; + int height; + GLenum min_filter; + GLenum mag_filter; + GLint wrap_mode_s; + GLint wrap_mode_t; + gboolean auto_mipmap; + gboolean mipmaps_dirty; + gboolean is_foreign; + + CoglTexturePixel first_pixel; +}; + +CoglHandle +_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + GError **error); + +#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, + GError **error); +#endif + +/* + * _cogl_texture_2d_externally_modified: + * @handle: A handle to a 2D texture + * + * 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 (CoglHandle handle); + +/* + * _cogl_texture_2d_copy_from_framebuffer: + * @handle: A handle to a 2D texture + * @dst_x: X-position to store the image within the texture + * @dst_y: Y-position to store the image within the texture + * @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 + * + * This copies a portion of the current read framebuffer into the + * texture. + */ +void +_cogl_texture_2d_copy_from_framebuffer (CoglHandle handle, + int dst_x, + int dst_y, + int src_x, + int src_y, + int width, + int height); + +#endif /* __COGL_TEXTURE_2D_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..0a388ee --- /dev/null +++ b/cogl/cogl-texture-2d-sliced-private.h @@ -0,0 +1,60 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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; + + int width; + int height; +}; + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_foreign (GLuint gl_handle, + GLenum gl_target, + GLuint width, + GLuint height, + GLuint x_pot_waste, + GLuint y_pot_waste, + CoglPixelFormat format); + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format); + +#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..836caaf --- /dev/null +++ b/cogl/cogl-texture-2d-sliced.c @@ -0,0 +1,1321 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + * + * 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-private.h" +#include "cogl-texture-2d-sliced-private.h" +#include "cogl-texture-driver.h" +#include "cogl-context-private.h" +#include "cogl-handle.h" +#include "cogl-spans.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-opengl-private.h" + +#include +#include +#include + +static void _cogl_texture_2d_sliced_free (CoglTexture2DSliced *tex_2ds); + +COGL_TEXTURE_DEFINE (Texture2DSliced, texture_2d_sliced); + +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; + float re_normalized_coords[4] = + { + sub_texture_coords[0] * data->x_normalize_factor, + sub_texture_coords[1] * data->y_normalize_factor, + sub_texture_coords[2] * data->x_normalize_factor, + sub_texture_coords[3] * data->y_normalize_factor + }; + + data->callback (sub_texture, re_normalized_coords, meta_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_2ds->width; + data.y_normalize_factor = 1.0f / tex_2ds->height; + + un_normalized_coords[0] = virtual_tx_1 * data.x_normalize_factor; + un_normalized_coords[1] = virtual_ty_1 * data.y_normalize_factor; + un_normalized_coords[2] = virtual_tx_2 * data.x_normalize_factor; + un_normalized_coords[3] = virtual_ty_2 * data.y_normalize_factor; + + _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, + 1, /* x_normalize_factor */ + 1, /* y_normalize_factor */ + COGL_PIPELINE_WRAP_MODE_REPEAT, + COGL_PIPELINE_WRAP_MODE_REPEAT, + re_normalize_sub_texture_coords_cb, + &data); +} + +static guint8 * +_cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds, + CoglPixelFormat format) +{ + CoglSpan *last_x_span; + CoglSpan *last_y_span; + guint8 *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 void +_cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds, + CoglBitmap *source_bmp, + CoglTexture2D *slice_tex, + guint8 *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) +{ + gboolean need_x, need_y; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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); + guint8 *bmp_data; + const guint8 *src; + guint8 *dst; + unsigned int wy, wx; + CoglBitmap *waste_bmp; + + bmp_data = _cogl_bitmap_map (source_bmp, COGL_BUFFER_ACCESS_READ, 0); + + if (bmp_data == NULL) + return; + + 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); + + cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + 0, /* src_x */ + 0, /* src_y */ + /* dst_x */ + x_span->size - x_span->waste, + y_iter->intersect_start - + y_span->start, /* dst_y */ + x_span->waste, /* dst_width */ + /* dst_height */ + y_iter->intersect_end - + y_iter->intersect_start, + waste_bmp); + + 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); + + cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + 0, /* src_x */ + 0, /* src_y */ + /* dst_x */ + x_iter->intersect_start - + x_iter->pos, + /* dst_y */ + y_span->size - y_span->waste, + copy_width, /* dst_width */ + y_span->waste, /* dst_height */ + waste_bmp); + + cogl_object_unref (waste_bmp); + } + + _cogl_bitmap_unmap (source_bmp); + } +} + +static gboolean +_cogl_texture_2d_sliced_upload_to_gl (CoglTexture2DSliced *tex_2ds, + CoglBitmap *bmp) +{ + CoglSpan *x_span; + CoglSpan *y_span; + CoglTexture2D *slice_tex; + int x, y; + guint8 *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); + + cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + x_span->start, /* src x */ + y_span->start, /* src y */ + 0, /* dst x */ + 0, /* dst y */ + x_span->size - + x_span->waste, /* width */ + y_span->size - + y_span->waste, /* height */ + bmp); + + /* 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; + + _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); /* dst_y */ + } + } + + if (waste_buf) + g_free (waste_buf); + + return TRUE; +} + +static gboolean +_cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + CoglBitmap *source_bmp, + GLuint source_gl_format, + GLuint source_gl_type) +{ + 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; + guint8 *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_2ds->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_2ds->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); + + cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex), + source_x, + source_y, + local_x, /* dst x */ + local_y, /* dst y */ + inter_w, /* width */ + inter_h, /* height */ + source_bmp); + + _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); + } + } + + 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_set_wrap_mode_parameters (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_set_wrap_mode_parameters (COGL_TEXTURE (slice_tex), + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); + } +} + +static gboolean +_cogl_texture_2d_sliced_slices_create (CoglContext *ctx, + CoglTexture2DSliced *tex_2ds, + int width, int height, + CoglPixelFormat format) +{ + int max_width; + int max_height; + CoglTexture2D **slice_textures; + int n_x_slices; + int n_y_slices; + int n_slices; + int x, y; + CoglSpan *x_span; + CoglSpan *y_span; + GLenum gl_intformat; + GLenum gl_type; + + 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; + } + + ctx->texture_driver->pixel_format_to_gl (format, + &gl_intformat, + NULL, + &gl_type); + + /* Negative number means no slicing forced by the user */ + if (tex_2ds->max_waste <= -1) + { + CoglSpan span; + + /* Check if size supported else bail out */ + if (!ctx->texture_driver->size_supported (GL_TEXTURE_2D, + gl_intformat, + gl_type, + max_width, + max_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->texture_driver->size_supported (GL_TEXTURE_2D, + gl_intformat, + gl_type, + max_width, + max_height)) + { + /* Alternate between width and height */ + if (max_width > max_height) + max_width /= 2; + else + max_height /= 2; + + if (max_width == 0 || max_height == 0) + return FALSE; + } + + /* Determine the slices required to cover the bitmap area */ + n_x_slices = slices_for_size (width, + max_width, tex_2ds->max_waste, + NULL); + + n_y_slices = slices_for_size (height, + max_height, tex_2ds->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, tex_2ds->max_waste, + tex_2ds->slice_x_spans); + + slices_for_size (height, + max_height, tex_2ds->max_waste, + tex_2ds->slice_y_spans); + } + + /* Init and resize GL handle array */ + n_slices = n_x_slices * n_y_slices; + + tex_2ds->slice_textures = g_array_sized_new (FALSE, FALSE, + sizeof (CoglTexture2D *), + n_slices); + + g_array_set_size (tex_2ds->slice_textures, n_slices); + + slice_textures = (CoglTexture2D **) tex_2ds->slice_textures->data; + + /* Init each GL texture object */ + 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) + { + GError *error = NULL; + 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_textures[y * n_x_slices + x] = + cogl_texture_2d_new_with_size (ctx, x_span->size, y_span->size, + format, &error); + if (!slice_textures[y * n_x_slices + x]) + { + g_array_set_size (tex_2ds->slice_textures, y * n_x_slices + x); + g_error_free (error); + return FALSE; + } + } + } + + return TRUE; +} + +static void +_cogl_texture_2d_sliced_slices_free (CoglTexture2DSliced *tex_2ds) +{ + if (tex_2ds->slice_x_spans != NULL) + g_array_free (tex_2ds->slice_x_spans, TRUE); + + if (tex_2ds->slice_y_spans != NULL) + g_array_free (tex_2ds->slice_y_spans, TRUE); + + 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_handle_unref (slice_tex); + } + + g_array_free (tex_2ds->slice_textures, TRUE); + } +} + +static void +_cogl_texture_2d_sliced_free (CoglTexture2DSliced *tex_2ds) +{ + _cogl_texture_2d_sliced_slices_free (tex_2ds); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_2ds)); +} + +static gboolean +_cogl_texture_2d_sliced_init_base (CoglContext *ctx, + CoglTexture2DSliced *tex_2ds, + int width, + int height, + CoglPixelFormat internal_format) +{ + CoglTexture *tex = COGL_TEXTURE (tex_2ds); + + _cogl_texture_init (tex, &cogl_texture_2d_sliced_vtable); + + tex_2ds->slice_x_spans = NULL; + tex_2ds->slice_y_spans = NULL; + tex_2ds->slice_textures = NULL; + + /* Create slices for the given format and size */ + if (!_cogl_texture_2d_sliced_slices_create (ctx, + tex_2ds, + width, + height, + internal_format)) + return FALSE; + + tex_2ds->width = width; + tex_2ds->height = height; + + return TRUE; +} + +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_with_size (CoglContext *ctx, + unsigned int width, + unsigned int height, + int max_waste, + CoglPixelFormat internal_format, + GError **error) +{ + CoglTexture2DSliced *tex_2ds; + + /* Since no data, we need some internal format */ + if (internal_format == COGL_PIXEL_FORMAT_ANY) + internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + + /* Init texture with empty bitmap */ + tex_2ds = g_new (CoglTexture2DSliced, 1); + + tex_2ds->max_waste = max_waste; + + if (!_cogl_texture_2d_sliced_init_base (ctx, + tex_2ds, + width, height, + internal_format)) + { + _cogl_texture_2d_sliced_free (tex_2ds); + g_set_error (error, + COGL_ERROR, + COGL_ERROR_NO_MEMORY, + "Not enough memory to allocate texture slices"); + return NULL; + } + + return _cogl_texture_2d_sliced_handle_new (tex_2ds); +} + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglTexture2DSliced *tex_2ds; + CoglBitmap *dst_bmp; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + int width, height; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); + + width = cogl_bitmap_get_width (bmp); + height = cogl_bitmap_get_height (bmp); + + /* Create new texture and fill with loaded data */ + tex_2ds = g_new0 (CoglTexture2DSliced, 1); + + if (flags & COGL_TEXTURE_NO_SLICING) + tex_2ds->max_waste = -1; + else + tex_2ds->max_waste = COGL_TEXTURE_MAX_WASTE; + + dst_bmp = _cogl_texture_prepare_for_upload (bmp, + internal_format, + &internal_format, + &gl_intformat, + &gl_format, + &gl_type); + if (dst_bmp == NULL) + { + _cogl_texture_2d_sliced_free (tex_2ds); + return NULL; + } + + if (!_cogl_texture_2d_sliced_init_base (ctx, + tex_2ds, + width, height, + internal_format)) + goto error; + + if (!_cogl_texture_2d_sliced_upload_to_gl (tex_2ds, + dst_bmp)) + goto error; + + cogl_object_unref (dst_bmp); + + return _cogl_texture_2d_sliced_handle_new (tex_2ds); + + error: + cogl_object_unref (dst_bmp); + _cogl_texture_2d_sliced_free (tex_2ds); + return NULL; +} + +CoglTexture2DSliced * +_cogl_texture_2d_sliced_new_from_foreign (GLuint gl_handle, + GLenum gl_target, + GLuint width, + GLuint height, + GLuint x_pot_waste, + GLuint y_pot_waste, + CoglPixelFormat format) +{ + /* NOTE: width, height and internal format are not queriable + * in GLES, hence such a function prototype. + */ + + GLint gl_width = 0; + GLint gl_height = 0; + CoglTexture2DSliced *tex_2ds; + CoglTexture *tex; + CoglSpan x_span; + CoglSpan y_span; + CoglTexture2D *tex_2d; + + _COGL_GET_CONTEXT (ctx, NULL); + + /* 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 */ + g_assert (gl_target == GL_TEXTURE_2D); + + gl_width = width + x_pot_waste; + gl_height = height + y_pot_waste; + + /* Validate pot waste */ + if (x_pot_waste < 0 || x_pot_waste >= width || + y_pot_waste < 0 || y_pot_waste >= height) + return NULL; + + tex_2d = cogl_texture_2d_new_from_foreign (ctx, + gl_target, + gl_width, + gl_height, + format, + NULL); + + if (!tex_2d) + return NULL; + + /* 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 (COGL_TEXTURE (tex_2d)); + + /* Create new texture */ + tex_2ds = g_new0 (CoglTexture2DSliced, 1); + + tex = COGL_TEXTURE (tex_2ds); + tex->vtable = &cogl_texture_2d_sliced_vtable; + + tex_2ds->width = gl_width - x_pot_waste; + tex_2ds->height = gl_height - y_pot_waste; + tex_2ds->max_waste = 0; + + /* 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); + + return _cogl_texture_2d_sliced_handle_new (tex_2ds); +} + +static gboolean +_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 gboolean +_cogl_texture_2d_sliced_is_sliced (CoglTexture *tex) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + + if (tex_2ds->slice_textures == NULL) + return FALSE; + + if (tex_2ds->slice_textures->len <= 1) + return FALSE; + + return TRUE; +} + +static gboolean +_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_2ds->width / (float)x_span->size; + *t *= tex_2ds->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) +{ + gboolean 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 gboolean +_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_set_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + CoglTexture2D *slice_tex; + int i; + + /* Make sure slices were created */ + if (tex_2ds->slice_textures == NULL) + return; + + /* 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_set_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; + + /* Make sure slices were created */ + if (tex_2ds->slice_textures == NULL) + return; + + /* 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; + + /* Make sure slices were created */ + if (tex_2ds->slice_textures == NULL) + return; + + /* 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 gboolean +_cogl_texture_2d_sliced_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); + GLenum gl_format; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, FALSE); + + bmp = _cogl_texture_prepare_for_upload (bmp, + cogl_texture_get_format (tex), + NULL, + NULL, + &gl_format, + &gl_type); + + /* Send data to GL */ + _cogl_texture_2d_sliced_upload_subregion_to_gl (tex_2ds, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + bmp, + gl_format, + gl_type); + + cogl_object_unref (bmp); + + return TRUE; +} + +static CoglPixelFormat +_cogl_texture_2d_sliced_get_format (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 0; + + /* Pass the call on to the first slice */ + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); + return cogl_texture_get_format (COGL_TEXTURE (slice_tex)); +} + +static GLenum +_cogl_texture_2d_sliced_get_gl_format (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 0; + + /* Pass the call on to the first slice */ + slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0); + return _cogl_texture_get_gl_format (COGL_TEXTURE (slice_tex)); +} + +static int +_cogl_texture_2d_sliced_get_width (CoglTexture *tex) +{ + return COGL_TEXTURE_2D_SLICED (tex)->width; +} + +static int +_cogl_texture_2d_sliced_get_height (CoglTexture *tex) +{ + return COGL_TEXTURE_2D_SLICED (tex)->height; +} + +static CoglTextureType +_cogl_texture_2d_sliced_get_type (CoglTexture *tex) +{ + return COGL_TEXTURE_TYPE_2D; +} + +static const CoglTextureVtable +cogl_texture_2d_sliced_vtable = + { + _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_set_filters, + _cogl_texture_2d_sliced_pre_paint, + _cogl_texture_2d_sliced_ensure_non_quad_rendering, + _cogl_texture_2d_sliced_set_wrap_mode_parameters, + _cogl_texture_2d_sliced_get_format, + _cogl_texture_2d_sliced_get_gl_format, + _cogl_texture_2d_sliced_get_width, + _cogl_texture_2d_sliced_get_height, + _cogl_texture_2d_sliced_get_type, + _cogl_texture_2d_sliced_is_foreign + }; diff --git a/cogl/cogl-texture-2d-sliced.h b/cogl/cogl-texture-2d-sliced.h new file mode 100644 index 0000000..b64d0be --- /dev/null +++ b/cogl/cogl-texture-2d-sliced.h @@ -0,0 +1,116 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_TEXURE_2D_SLICED_H +#define __COGL_TEXURE_2D_SLICED_H + +#include "cogl-context.h" +#include "cogl-types.h" + +#include + +/** + * 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) + +/** + * 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 in the non-power-of-two textures before + * they must be sliced to reduce the amount of waste. + * @internal_format: The format of the texture + * @error: A #GError for exceptions. + * + * Creates a #CoglTexture2DSliced that may internally be comprised of + * 1 or more #CoglTexture2D textures with power-of-two sizes. + * @max_waste is used as a threshold for recursively slicing the + * right-most or bottom-most slices into smaller power-of-two sizes + * until the wasted padding at the bottom and right of the + * power-of-two textures is less than specified. + * + * Returns: A newly allocated #CoglTexture2DSliced or if there was + * an error allocating any of the internal slices %NULL is + * returned and @error is updated. + * + * Since: 1.10 + * Stability: unstable + */ +CoglTexture2DSliced * +cogl_texture_2d_sliced_new_with_size (CoglContext *ctx, + unsigned int width, + unsigned int height, + int max_waste, + CoglPixelFormat internal_format, + GError **error); + +/** + * 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 + */ +gboolean +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..dad1eac --- /dev/null +++ b/cogl/cogl-texture-2d.c @@ -0,0 +1,889 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + * + * 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-driver.h" +#include "cogl-context-private.h" +#include "cogl-handle.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-framebuffer-private.h" +#ifdef COGL_HAS_EGL_SUPPORT +#include "cogl-winsys-egl-private.h" +#endif + +#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); + +static const CoglTextureVtable cogl_texture_2d_vtable; + +typedef struct _CoglTexture2DManualRepeatData +{ + CoglTexture2D *tex_2d; + CoglMetaTextureCallback callback; + void *user_data; +} CoglTexture2DManualRepeatData; + +static void +_cogl_texture_2d_set_wrap_mode_parameters (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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->wrap_mode_s != wrap_mode_s || + tex_2d->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->wrap_mode_s = wrap_mode_s; + tex_2d->wrap_mode_t = wrap_mode_t; + } +} + +static void +_cogl_texture_2d_free (CoglTexture2D *tex_2d) +{ + if (!tex_2d->is_foreign) + _cogl_delete_gl_texture (tex_2d->gl_texture); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_2d)); +} + +static gboolean +_cogl_texture_2d_can_create (unsigned int width, + unsigned int height, + CoglPixelFormat internal_format) +{ + GLenum gl_intformat; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, 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))) + return FALSE; + + ctx->texture_driver->pixel_format_to_gl (internal_format, + &gl_intformat, + NULL, + &gl_type); + + /* Check that the driver can create a texture with that size */ + if (!ctx->texture_driver->size_supported (GL_TEXTURE_2D, + gl_intformat, + gl_type, + width, + height)) + return FALSE; + + return TRUE; +} + +static CoglTexture2D * +_cogl_texture_2d_create_base (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglTexture2D *tex_2d = g_new (CoglTexture2D, 1); + CoglTexture *tex = COGL_TEXTURE (tex_2d); + + _cogl_texture_init (tex, &cogl_texture_2d_vtable); + + tex_2d->width = width; + tex_2d->height = height; + tex_2d->mipmaps_dirty = TRUE; + tex_2d->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0; + + /* We default to GL_LINEAR for both filters */ + tex_2d->min_filter = GL_LINEAR; + tex_2d->mag_filter = GL_LINEAR; + + /* Wrap mode not yet set */ + tex_2d->wrap_mode_s = GL_FALSE; + tex_2d->wrap_mode_t = GL_FALSE; + + tex_2d->is_foreign = FALSE; + + tex_2d->format = internal_format; + + return tex_2d; +} + +CoglTexture2D * +cogl_texture_2d_new_with_size (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + GError **error) +{ + CoglTexture2D *tex_2d; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + /* Since no data, we need some internal format */ + if (internal_format == COGL_PIXEL_FORMAT_ANY) + internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + + if (!_cogl_texture_2d_can_create (width, height, internal_format)) + { + g_set_error (error, COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "Failed to create texture 2d due to size/format" + " constraints"); + return NULL; + } + + internal_format = ctx->texture_driver->pixel_format_to_gl (internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + tex_2d = _cogl_texture_2d_create_base (width, height, COGL_TEXTURE_NONE, + internal_format); + + ctx->texture_driver->gen (GL_TEXTURE_2D, 1, &tex_2d->gl_texture); + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + GE( ctx, glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat, + width, height, 0, gl_format, gl_type, NULL) ); + + return _cogl_texture_2d_handle_new (tex_2d); +} + +CoglHandle +_cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + GError **error) +{ + CoglTexture2D *tex_2d; + CoglBitmap *dst_bmp; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + guint8 *data; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + _COGL_RETURN_VAL_IF_FAIL (bmp != NULL, COGL_INVALID_HANDLE); + + internal_format = + _cogl_texture_determine_internal_format (cogl_bitmap_get_format (bmp), + internal_format); + + if (!_cogl_texture_2d_can_create (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + internal_format)) + { + g_set_error (error, COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "Failed to create texture 2d due to size/format" + " constraints"); + return NULL; + + } + + if ((dst_bmp = _cogl_texture_prepare_for_upload (bmp, + internal_format, + &internal_format, + &gl_intformat, + &gl_format, + &gl_type)) == NULL) + { + g_set_error (error, COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_FORMAT, + "Failed to prepare texture upload due to format"); + return NULL; + } + + tex_2d = _cogl_texture_2d_create_base (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + flags, + internal_format); + + /* 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) && + (data = _cogl_bitmap_map (dst_bmp, + COGL_BUFFER_ACCESS_READ, 0))) + { + CoglPixelFormat format = cogl_bitmap_get_format (dst_bmp); + tex_2d->first_pixel.gl_format = gl_format; + tex_2d->first_pixel.gl_type = gl_type; + memcpy (tex_2d->first_pixel.data, data, + _cogl_pixel_format_get_bytes_per_pixel (format)); + + _cogl_bitmap_unmap (dst_bmp); + } + + ctx->texture_driver->gen (GL_TEXTURE_2D, 1, &tex_2d->gl_texture); + ctx->texture_driver->upload_to_gl (GL_TEXTURE_2D, + tex_2d->gl_texture, + FALSE, + dst_bmp, + gl_intformat, + gl_format, + gl_type); + + tex_2d->gl_format = gl_intformat; + + cogl_object_unref (dst_bmp); + + return _cogl_texture_2d_handle_new (tex_2d); +} + +CoglTexture2D * +cogl_texture_2d_new_from_data (CoglContext *ctx, + int width, + int height, + CoglPixelFormat format, + CoglPixelFormat internal_format, + int rowstride, + const guint8 *data, + GError **error) +{ + CoglBitmap *bmp; + CoglHandle 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, + (guint8 *) data); + + tex =_cogl_texture_2d_new_from_bitmap (bmp, COGL_TEXTURE_NONE, + internal_format, + error); + + cogl_object_unref (bmp); + + return tex; +} + +CoglTexture2D * +cogl_texture_2d_new_from_foreign (CoglContext *ctx, + GLuint gl_handle, + int width, + int height, + CoglPixelFormat format, + GError **error) +{ + /* NOTE: width, height and internal format are not queriable + * in GLES, hence such a function prototype. + */ + + GLenum gl_error = 0; + GLint gl_compressed = GL_FALSE; + GLenum gl_int_format = 0; + CoglTexture2D *tex_2d; + + if (!ctx->texture_driver->allows_foreign_gl_target (GL_TEXTURE_2D)) + return COGL_INVALID_HANDLE; + + /* Make sure it is a valid GL texture object */ + if (!ctx->glIsTexture (gl_handle)) + return COGL_INVALID_HANDLE; + + /* Make sure binding succeeds */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, gl_handle, TRUE); + if (ctx->glGetError () != GL_NO_ERROR) + return COGL_INVALID_HANDLE; + + /* Obtain texture parameters + (only level 0 we are interested in) */ + +#if HAVE_COGL_GL + if (ctx->driver == COGL_DRIVER_GL) + { + 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->texture_driver->pixel_format_from_gl_internal (gl_int_format, + &format)) + return COGL_INVALID_HANDLE; + } + else +#endif + { + /* Otherwise we'll assume we can derive the GL format from the + passed in format */ + ctx->texture_driver->pixel_format_to_gl (format, + &gl_int_format, + NULL, + NULL); + } + + /* 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. + */ + + /* Validate width and height */ + if (width <= 0 || height <= 0) + return COGL_INVALID_HANDLE; + + /* Compressed texture images not supported */ + if (gl_compressed == GL_TRUE) + return COGL_INVALID_HANDLE; + + /* 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_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. */ + + /* Create new texture */ + tex_2d = _cogl_texture_2d_create_base (width, height, + COGL_TEXTURE_NO_AUTO_MIPMAP, + format); + + /* Setup bitmap info */ + tex_2d->is_foreign = TRUE; + tex_2d->mipmaps_dirty = TRUE; + + tex_2d->format = format; + + tex_2d->gl_texture = gl_handle; + tex_2d->gl_format = gl_int_format; + + /* Unknown filter */ + tex_2d->min_filter = GL_FALSE; + tex_2d->mag_filter = GL_FALSE; + + return _cogl_texture_2d_handle_new (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, + GError **error) +{ + CoglTexture2D *tex_2d; + GLenum gl_error; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints & + COGL_RENDERER_CONSTRAINT_USES_EGL, + NULL); + + _COGL_RETURN_VAL_IF_FAIL (ctx->private_feature_flags & + COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, + NULL); + + tex_2d = _cogl_texture_2d_create_base (width, height, COGL_TEXTURE_NONE, + format); + + ctx->texture_driver->gen (GL_TEXTURE_2D, 1, &tex_2d->gl_texture); + _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, image); + if (ctx->glGetError () != GL_NO_ERROR) + { + g_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_BAD_PARAMETER, + "Could not create a CoglTexture2D from a given EGLImage"); + return NULL; + } + + return _cogl_texture_2d_handle_new (tex_2d); +} +#endif /* defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) */ + +#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT +CoglTexture2D * +cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx, + struct wl_buffer *buffer, + GError **error) +{ + if (wl_buffer_is_shm (buffer)) + { + int stride = wl_shm_buffer_get_stride (buffer); + CoglPixelFormat format; + CoglPixelFormat internal_format = COGL_PIXEL_FORMAT_ANY; + + switch (wl_shm_buffer_get_format (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_XRGB32: + format = COGL_PIXEL_FORMAT_ARGB_8888; + internal_format = COGL_PIXEL_FORMAT_RGB_888; + 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; + internal_format = COGL_PIXEL_FORMAT_BGR_888; + break; +#endif + default: + g_warn_if_reached (); + format = COGL_PIXEL_FORMAT_ARGB_8888; + } + + return cogl_texture_2d_new_from_data (ctx, + buffer->width, + buffer->height, + format, + internal_format, + stride, + wl_shm_buffer_get_data (buffer), + error); + } + else + { + EGLImageKHR image; + CoglTexture2D *tex; + + _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints & + COGL_RENDERER_CONSTRAINT_USES_EGL, + NULL); + image = _cogl_egl_create_image (ctx, + EGL_WAYLAND_BUFFER_WL, + buffer, + NULL); + tex = _cogl_egl_texture_2d_new_from_image (ctx, + buffer->width, + buffer->height, + COGL_PIXEL_FORMAT_ARGB_8888_PRE, + image, + error); + _cogl_egl_destroy_image (ctx, image); + return tex; + } +} +#endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */ + +void +_cogl_texture_2d_externally_modified (CoglHandle handle) +{ + if (!cogl_is_texture_2d (handle)) + return; + + COGL_TEXTURE_2D (handle)->mipmaps_dirty = TRUE; +} + +void +_cogl_texture_2d_copy_from_framebuffer (CoglHandle handle, + int dst_x, + int dst_y, + int src_x, + int src_y, + int width, + int height) +{ + CoglTexture2D *tex_2d; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _COGL_RETURN_IF_FAIL (cogl_is_texture_2d (handle)); + + tex_2d = COGL_TEXTURE_2D (handle); + + /* 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 (cogl_get_draw_framebuffer (), + _cogl_get_read_framebuffer (), + 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); + + tex_2d->mipmaps_dirty = TRUE; +} + +static int +_cogl_texture_2d_get_max_waste (CoglTexture *tex) +{ + return -1; +} + +static gboolean +_cogl_texture_2d_is_sliced (CoglTexture *tex) +{ + return FALSE; +} + +static gboolean +_cogl_texture_2d_can_hardware_repeat (CoglTexture *tex) +{ + return TRUE; +} + +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 */ + + gboolean 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 gboolean +_cogl_texture_2d_get_gl_texture (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + if (out_gl_handle) + *out_gl_handle = tex_2d->gl_texture; + + if (out_gl_target) + *out_gl_target = GL_TEXTURE_2D; + + return TRUE; +} + +static void +_cogl_texture_2d_set_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (min_filter == tex_2d->min_filter + && mag_filter == tex_2d->mag_filter) + return; + + /* Store new values */ + tex_2d->min_filter = min_filter; + tex_2d->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) ); +} + +static void +_cogl_texture_2d_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Only update if the mipmaps are dirty */ + if ((flags & COGL_TEXTURE_NEEDS_MIPMAP) && + tex_2d->auto_mipmap && tex_2d->mipmaps_dirty) + { + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + + /* 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)) + ctx->texture_driver->gl_generate_mipmaps (GL_TEXTURE_2D); +#if defined(HAVE_COGL_GLES) || defined(HAVE_COGL_GL) + else + { + 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 + + tex_2d->mipmaps_dirty = FALSE; + } +} + +static void +_cogl_texture_2d_ensure_non_quad_rendering (CoglTexture *tex) +{ + /* Nothing needs to be done */ +} + +static gboolean +_cogl_texture_2d_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + GLenum gl_format; + GLenum gl_type; + guint8 *data; + + _COGL_GET_CONTEXT (ctx, FALSE); + + bmp = _cogl_texture_prepare_for_upload (bmp, + cogl_texture_get_format (tex), + NULL, + NULL, + &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) && + (data = _cogl_bitmap_map (bmp, COGL_BUFFER_ACCESS_READ, 0))) + { + CoglPixelFormat bpp = + _cogl_pixel_format_get_bytes_per_pixel (cogl_bitmap_get_format (bmp)); + tex_2d->first_pixel.gl_format = gl_format; + tex_2d->first_pixel.gl_type = gl_type; + memcpy (tex_2d->first_pixel.data, + data + cogl_bitmap_get_rowstride (bmp) * src_y + bpp * src_x, + bpp); + + _cogl_bitmap_unmap (bmp); + } + + /* Send data to GL */ + ctx->texture_driver->upload_subregion_to_gl (GL_TEXTURE_2D, + tex_2d->gl_texture, + FALSE, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + bmp, + gl_format, + gl_type); + + tex_2d->mipmaps_dirty = TRUE; + + cogl_object_unref (bmp); + + return TRUE; +} + +static gboolean +_cogl_texture_2d_get_data (CoglTexture *tex, + CoglPixelFormat format, + unsigned int rowstride, + guint8 *data) +{ + CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); + int bpp; + GLenum gl_format; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, FALSE); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + + ctx->texture_driver->pixel_format_to_gl (format, + NULL, /* internal format */ + &gl_format, + &gl_type); + + ctx->texture_driver->prep_gl_for_pixels_download (rowstride, bpp); + + _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, + tex_2d->gl_texture, + tex_2d->is_foreign); + return ctx->texture_driver->gl_get_tex_image (GL_TEXTURE_2D, + gl_format, + gl_type, + data); +} + +static CoglPixelFormat +_cogl_texture_2d_get_format (CoglTexture *tex) +{ + return COGL_TEXTURE_2D (tex)->format; +} + +static GLenum +_cogl_texture_2d_get_gl_format (CoglTexture *tex) +{ + return COGL_TEXTURE_2D (tex)->gl_format; +} + +static int +_cogl_texture_2d_get_width (CoglTexture *tex) +{ + return COGL_TEXTURE_2D (tex)->width; +} + +static int +_cogl_texture_2d_get_height (CoglTexture *tex) +{ + return COGL_TEXTURE_2D (tex)->height; +} + +static gboolean +_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 = + { + _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_set_filters, + _cogl_texture_2d_pre_paint, + _cogl_texture_2d_ensure_non_quad_rendering, + _cogl_texture_2d_set_wrap_mode_parameters, + _cogl_texture_2d_get_format, + _cogl_texture_2d_get_gl_format, + _cogl_texture_2d_get_width, + _cogl_texture_2d_get_height, + _cogl_texture_2d_get_type, + _cogl_texture_2d_is_foreign + }; diff --git a/cogl/cogl-texture-2d.h b/cogl/cogl-texture-2d.h new file mode 100644 index 0000000..f191924 --- /dev/null +++ b/cogl/cogl-texture-2d.h @@ -0,0 +1,190 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TEXURE_2D_H +#define __COGL_TEXURE_2D_H + +#include "cogl-context.h" + +#include + +G_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) + +#define cogl_is_texture_2d cogl_is_texture_2d_EXP +/** + * 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 + */ +gboolean +cogl_is_texture_2d (void *object); + +#define cogl_texture_2d_new_with_size cogl_texture_2d_new_with_size_EXP +/** + * cogl_texture_2d_new_with_size: + * @ctx: A #CoglContext + * @width: Width of the texture to allocate + * @height: Height of the texture to allocate + * @internal_format: The format of the texture + * @error: A #GError for exceptions + * + * Allocates a low-level #CoglTexture2D texture that your GPU can + * texture from directly. This is unlike sliced textures for example + * which may be comprised of multiple internal textures, or atlas + * textures where Cogl has to modify texture coordinates before they + * may be used by the GPU. + * + * 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: 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_with_size (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + GError **error); + +#define cogl_texture_2d_new_from_data cogl_texture_2d_new_from_data_EXP +/** + * 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 + * @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. 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 #GError for exceptions + * + * Creates a new #CoglTexture2D texture based on data residing in memory. + * These are unlike sliced textures for example which may be comprised + * of multiple internal textures, or atlas textures where Cogl has to + * modify texture coordinates before they may be used by the GPU. + * + * 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: 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, + CoglPixelFormat internal_format, + int rowstride, + const guint8 *data, + GError **error); + +#define cogl_texture_2d_new_from_foreign cogl_texture_2d_new_from_foreign_EXP +/** + * cogl_texture_2d_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 + * @internal_format: The format of the texture + * @error: A #GError for exceptions + * + * Wraps an existing GL_TEXTURE_2D texture object as a #CoglTexture2D. + * This can be used for integrating Cogl with software using OpenGL + * directly. + * + * The results are undefined for passing an invalid @gl_handle + * or if @width or @height don't have the correct texture + * geometry. + * + * Returns: A newly allocated #CoglTexture2D, or if Cogl could not + * validate the @gl_handle in some way (perhaps because of + * an unsupported format) it will return %NULL and set + * @error. + * + * Since: 2.0 + */ +CoglTexture2D * +cogl_texture_2d_new_from_foreign (CoglContext *ctx, + unsigned int gl_handle, + int width, + int height, + CoglPixelFormat format, + GError **error); + +G_END_DECLS + +#endif /* __COGL_TEXURE_2D_H */ diff --git a/cogl/cogl-texture-3d-private.h b/cogl/cogl-texture-3d-private.h new file mode 100644 index 0000000..b1cc7d8 --- /dev/null +++ b/cogl/cogl-texture-3d-private.h @@ -0,0 +1,91 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * Authors: + * Neil Roberts + */ + +#ifndef __COGL_TEXTURE_3D_PRIVATE_H +#define __COGL_TEXTURE_3D_PRIVATE_H + +#include "cogl-handle.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 GL texture represented as a + CoglPixelFormat */ + CoglPixelFormat format; + /* The internal format of the GL texture represented as a GL enum */ + GLenum gl_format; + /* The texture object number */ + GLuint gl_texture; + int width; + int height; + int depth; + GLenum min_filter; + GLenum mag_filter; + GLint wrap_mode_s; + GLint wrap_mode_t; + GLint wrap_mode_p; + gboolean auto_mipmap; + gboolean mipmaps_dirty; + + CoglTexturePixel first_pixel; +}; + +/* + * cogl_texture_3d_new_from_bitmap: + * @bmp_handle: A #CoglBitmap object. + * @height: height of the texture in pixels. + * @depth: depth of the texture in pixels. + * @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_pipeline_set_blend()) or use the data for + * something other than straight blending. + * @error: A GError return location. + * + * Creates a new 3D texture and initializes it with the images in + * @bmp_handle. 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. + * + * Return value: the newly created texture or %NULL if + * there was an error. + */ +CoglTexture3D * +_cogl_texture_3d_new_from_bitmap (CoglContext *context, + CoglBitmap *bmp, + unsigned int height, + unsigned int depth, + CoglPixelFormat internal_format, + GError **error); + +#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..8662d5a --- /dev/null +++ b/cogl/cogl-texture-3d.c @@ -0,0 +1,626 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * 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-driver.h" +#include "cogl-context-private.h" +#include "cogl-handle.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-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); + +static const CoglTextureVtable cogl_texture_3d_vtable; + +static void +_cogl_texture_3d_set_wrap_mode_parameters (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Only set the wrap mode if it's different from the current value + to avoid too many GL calls. */ + if (tex_3d->wrap_mode_s != wrap_mode_s || + tex_3d->wrap_mode_t != wrap_mode_t || + tex_3d->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->wrap_mode_s = wrap_mode_s; + tex_3d->wrap_mode_t = wrap_mode_t; + tex_3d->wrap_mode_p = wrap_mode_p; + } +} + +static void +_cogl_texture_3d_free (CoglTexture3D *tex_3d) +{ + _cogl_delete_gl_texture (tex_3d->gl_texture); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_3d)); +} + +static CoglTexture3D * +_cogl_texture_3d_create_base (CoglContext *ctx, + int width, + int height, + int depth, + CoglPixelFormat internal_format) +{ + CoglTexture3D *tex_3d = g_new (CoglTexture3D, 1); + CoglTexture *tex = COGL_TEXTURE (tex_3d); + + _cogl_texture_init (tex, &cogl_texture_3d_vtable); + + tex_3d->width = width; + tex_3d->height = height; + tex_3d->depth = depth; + tex_3d->mipmaps_dirty = TRUE; + tex_3d->auto_mipmap = TRUE; + + /* We default to GL_LINEAR for both filters */ + tex_3d->min_filter = GL_LINEAR; + tex_3d->mag_filter = GL_LINEAR; + + /* Wrap mode not yet set */ + tex_3d->wrap_mode_s = GL_FALSE; + tex_3d->wrap_mode_t = GL_FALSE; + tex_3d->wrap_mode_p = GL_FALSE; + + tex_3d->format = internal_format; + + return tex_3d; +} + +static gboolean +_cogl_texture_3d_can_create (CoglContext *ctx, + int width, + int height, + int depth, + CoglPixelFormat internal_format, + GError **error) +{ + GLenum gl_intformat; + GLenum gl_type; + + /* This should only happen on GLES */ + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) + { + g_set_error (error, + COGL_ERROR, + COGL_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))) + { + g_set_error (error, + COGL_ERROR, + COGL_ERROR_UNSUPPORTED, + "A non-power-of-two size was requested but this is not " + "supported by the GPU"); + return FALSE; + } + + ctx->texture_driver->pixel_format_to_gl (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 (GL_TEXTURE_3D, + gl_intformat, + gl_type, + width, + height, + depth)) + { + g_set_error (error, + COGL_ERROR, + COGL_ERROR_UNSUPPORTED, + "The requested dimensions are not supported by the GPU"); + return FALSE; + } + + return TRUE; +} + +CoglTexture3D * +cogl_texture_3d_new_with_size (CoglContext *ctx, + int width, + int height, + int depth, + CoglPixelFormat internal_format, + GError **error) +{ + CoglTexture3D *tex_3d; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + /* Since no data, we need some internal format */ + if (internal_format == COGL_PIXEL_FORMAT_ANY) + internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + + if (!_cogl_texture_3d_can_create (ctx, + width, height, depth, + internal_format, + error)) + return NULL; + + internal_format = ctx->texture_driver->pixel_format_to_gl (internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + tex_3d = _cogl_texture_3d_create_base (ctx, + width, height, depth, + internal_format); + + ctx->texture_driver->gen (GL_TEXTURE_3D, 1, &tex_3d->gl_texture); + _cogl_bind_gl_texture_transient (GL_TEXTURE_3D, + tex_3d->gl_texture, + FALSE); + GE( ctx, glTexImage3D (GL_TEXTURE_3D, 0, gl_intformat, + width, height, depth, 0, gl_format, gl_type, NULL) ); + + return _cogl_texture_3d_handle_new (tex_3d); +} + +CoglTexture3D * +_cogl_texture_3d_new_from_bitmap (CoglContext *ctx, + CoglBitmap *bmp, + unsigned int height, + unsigned int depth, + CoglPixelFormat internal_format, + GError **error) +{ + CoglTexture3D *tex_3d; + CoglBitmap *dst_bmp; + CoglPixelFormat bmp_format; + unsigned int bmp_width; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + guint8 *data; + + bmp_width = cogl_bitmap_get_width (bmp); + bmp_format = cogl_bitmap_get_format (bmp); + + internal_format = _cogl_texture_determine_internal_format (bmp_format, + internal_format); + + if (!_cogl_texture_3d_can_create (ctx, + bmp_width, height, depth, + internal_format, + error)) + return NULL; + + dst_bmp = _cogl_texture_prepare_for_upload (bmp, + internal_format, + &internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + if (dst_bmp == NULL) + { + g_set_error (error, COGL_BITMAP_ERROR, COGL_BITMAP_ERROR_FAILED, + "Bitmap conversion failed"); + return NULL; + } + + tex_3d = _cogl_texture_3d_create_base (ctx, + bmp_width, height, depth, + internal_format); + + /* 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) && + (data = _cogl_bitmap_map (dst_bmp, + COGL_BUFFER_ACCESS_READ, 0))) + { + CoglPixelFormat format = cogl_bitmap_get_format (dst_bmp); + tex_3d->first_pixel.gl_format = gl_format; + tex_3d->first_pixel.gl_type = gl_type; + memcpy (tex_3d->first_pixel.data, data, + _cogl_pixel_format_get_bytes_per_pixel (format)); + + _cogl_bitmap_unmap (dst_bmp); + } + + ctx->texture_driver->gen (GL_TEXTURE_3D, 1, &tex_3d->gl_texture); + + ctx->texture_driver->upload_to_gl_3d (GL_TEXTURE_3D, + tex_3d->gl_texture, + FALSE, /* is_foreign */ + height, + depth, + dst_bmp, + gl_intformat, + gl_format, + gl_type); + + tex_3d->gl_format = gl_intformat; + + cogl_object_unref (dst_bmp); + + return _cogl_texture_3d_handle_new (tex_3d); +} + +CoglTexture3D * +cogl_texture_3d_new_from_data (CoglContext *context, + int width, + int height, + int depth, + CoglPixelFormat format, + CoglPixelFormat internal_format, + int rowstride, + int image_stride, + const guint8 *data, + GError **error) +{ + CoglBitmap *bitmap; + CoglTexture3D *ret; + + /* These are considered a programmer errors so we won't set a + GError. It would be nice if this was a _COGL_RETURN_IF_FAIL but the + rest of Cogl isn't using that */ + if (format == COGL_PIXEL_FORMAT_ANY) + return NULL; + + if (data == NULL) + return 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) + { + guint8 *bmp_data; + int bmp_rowstride; + int z, y; + + bitmap = _cogl_bitmap_new_with_malloc_buffer (context, + width, + depth * height, + format); + + bmp_data = _cogl_bitmap_map (bitmap, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + + 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, + (guint8 *) data); + + ret = _cogl_texture_3d_new_from_bitmap (context, + bitmap, + height, + depth, + internal_format, + error); + + cogl_object_unref (bitmap); + + return ret; +} + +static int +_cogl_texture_3d_get_max_waste (CoglTexture *tex) +{ + return -1; +} + +static gboolean +_cogl_texture_3d_is_sliced (CoglTexture *tex) +{ + return FALSE; +} + +static gboolean +_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 */ + + gboolean 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 gboolean +_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_set_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexture3D *tex_3d = COGL_TEXTURE_3D (tex); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (min_filter == tex_3d->min_filter + && mag_filter == tex_3d->mag_filter) + return; + + /* Store new values */ + tex_3d->min_filter = min_filter; + tex_3d->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); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* Only update if the mipmaps are dirty */ + if ((flags & COGL_TEXTURE_NEEDS_MIPMAP) && + tex_3d->auto_mipmap && tex_3d->mipmaps_dirty) + { + _cogl_bind_gl_texture_transient (GL_TEXTURE_3D, + tex_3d->gl_texture, + FALSE); + /* 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)) + ctx->texture_driver->gl_generate_mipmaps (GL_TEXTURE_3D); +#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) + else if (ctx->driver != COGL_DRIVER_GLES2) + { + 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 gboolean +_cogl_texture_3d_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + /* This function doesn't really make sense for 3D textures because + it can't specify which image to upload to */ + return FALSE; +} + +static int +_cogl_texture_3d_get_data (CoglTexture *tex, + CoglPixelFormat format, + unsigned int rowstride, + guint8 *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)->format; +} + +static GLenum +_cogl_texture_3d_get_gl_format (CoglTexture *tex) +{ + return COGL_TEXTURE_3D (tex)->gl_format; +} + +static int +_cogl_texture_3d_get_width (CoglTexture *tex) +{ + return COGL_TEXTURE_3D (tex)->width; +} + +static int +_cogl_texture_3d_get_height (CoglTexture *tex) +{ + return COGL_TEXTURE_3D (tex)->height; +} + +static CoglTextureType +_cogl_texture_3d_get_type (CoglTexture *tex) +{ + return COGL_TEXTURE_TYPE_3D; +} + +static const CoglTextureVtable +cogl_texture_3d_vtable = + { + _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_set_filters, + _cogl_texture_3d_pre_paint, + _cogl_texture_3d_ensure_non_quad_rendering, + _cogl_texture_3d_set_wrap_mode_parameters, + _cogl_texture_3d_get_format, + _cogl_texture_3d_get_gl_format, + _cogl_texture_3d_get_width, + _cogl_texture_3d_get_height, + _cogl_texture_3d_get_type, + NULL /* is_foreign */ + }; diff --git a/cogl/cogl-texture-3d.h b/cogl/cogl-texture-3d.h new file mode 100644 index 0000000..6c14912 --- /dev/null +++ b/cogl/cogl-texture-3d.h @@ -0,0 +1,151 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * Authors: + * Neil Roberts + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TEXTURE_3D_H +#define __COGL_TEXTURE_3D_H + +#include + +G_BEGIN_DECLS + +/** + * SECTION:cogl-texture-3d + * @short_description: Fuctions 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) + +/** + * 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. + * @internal_format: the #CoglPixelFormat to use for the GPU + * storage of the texture. + * @error: A GError return location. + * + * Creates a new Cogl 3D texture with the specified dimensions and + * pixel format. + * + * Note that this function will throw a #GError if + * %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the + * requested dimensions are not supported by the GPU. + * + * Return value: a new #CoglTexture3D object or + * %NULL on failure and an exception will be returned + * in @error. + * Since: 1.10 + * Stability: Unstable + */ +CoglTexture3D * +cogl_texture_3d_new_with_size (CoglContext *context, + int width, + int height, + int depth, + CoglPixelFormat internal_format, + GError **error); + +/** + * 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 + * @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 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 GError return location. + * + * Creates a new 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 that this function will throw a #GError if + * %COGL_FEATURE_TEXTURE_3D is not advertised. It can also fail if the + * requested dimensions are not supported by the GPU. + * + * Return value: the newly created #CoglTexture3D or %NULL if + * there was an error an 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, + CoglPixelFormat internal_format, + int rowstride, + int image_stride, + const guint8 *data, + GError **error); + +/** + * 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 + */ +gboolean +cogl_is_texture_3d (void *object); + +G_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..6cbc3af --- /dev/null +++ b/cogl/cogl-texture-driver.h @@ -0,0 +1,208 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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. + */ + void + (* gen) (GLenum gl_target, + GLsizei n, + GLuint *textures); + + /* + * 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) (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 :-( + */ + void + (* upload_subregion_to_gl) (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + CoglBitmap *source_bmp, + GLuint source_gl_format, + GLuint source_gl_type); + + /* + * 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 + */ + void + (* upload_to_gl) (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type); + + /* + * 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. + */ + void + (* upload_to_gl_3d) (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + GLint height, + GLint depth, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type); + + /* + * 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) (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 () ) + */ + gboolean + (* gl_get_tex_image) (GLenum gl_target, + GLenum dest_gl_format, + GLenum dest_gl_type, + guint8 *dest); + + /* + * It may depend on the driver as to what texture sizes are supported... + */ + gboolean + (* size_supported) (GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height); + + gboolean + (* size_supported_3d) (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) ( + GLuint gl_target, + const GLfloat *transparent_color); + + /* + * XXX: this should live in cogl/{gl,gles}/cogl.c + */ + gboolean + (* pixel_format_from_gl_internal) (GLenum gl_int_format, + CoglPixelFormat *out_format); + + /* + * XXX: this should live in cogl/{gl,gles}/cogl.c + */ + CoglPixelFormat + (* pixel_format_to_gl) (CoglPixelFormat format, + GLenum *out_glintformat, + GLenum *out_glformat, + GLenum *out_gltype); + + /* + * 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 + */ + gboolean + (* allows_foreign_gl_target) (GLenum gl_target); + + /* + * glGenerateMipmap semantics may need to be emulated for some + * drivers. E.g. by enabling auto mipmap generation an re-loading a + * number of known texels. + */ + void + (* gl_generate_mipmaps) (GLenum texture_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) (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..9695179 --- /dev/null +++ b/cogl/cogl-texture-private.h @@ -0,0 +1,293 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_TEXTURE_PRIVATE_H +#define __COGL_TEXTURE_PRIVATE_H + +#include "cogl-bitmap-private.h" +#include "cogl-handle.h" +#include "cogl-pipeline-private.h" +#include "cogl-spans.h" +#include "cogl-meta-texture.h" +#include "cogl-framebuffer.h" + +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 */ + + /* 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 passed so the implementation is expected to call + _cogl_texture_prepare_for_upload with a suitable destination + format before uploading */ + gboolean (* set_region) (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bitmap); + + /* 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). */ + gboolean (* get_data) (CoglTexture *tex, + CoglPixelFormat format, + unsigned int rowstride, + guint8 *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); + + gboolean (* is_sliced) (CoglTexture *tex); + + gboolean (* 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); + + gboolean (* get_gl_texture) (CoglTexture *tex, + GLuint *out_gl_handle, + GLenum *out_gl_target); + + void (* set_filters) (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter); + + void (* pre_paint) (CoglTexture *tex, CoglTexturePrePaintFlags flags); + void (* ensure_non_quad_rendering) (CoglTexture *tex); + + void (* set_wrap_mode_parameters) (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); + int (* get_width) (CoglTexture *tex); + int (* get_height) (CoglTexture *tex); + + CoglTextureType (* get_type) (CoglTexture *tex); + + gboolean (* is_foreign) (CoglTexture *tex); +}; + +struct _CoglTexture +{ + CoglObject _parent; + GList *framebuffers; + 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; + guint8 data[4]; +}; + +void +_cogl_texture_init (CoglTexture *texture, + 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_HANDLE_DEFINE_WITH_CODE \ + (TypeName, type_name, \ + _cogl_texture_register_texture_type (&_cogl_##type_name##_class)) + +#define COGL_TEXTURE_INTERNAL_DEFINE(TypeName, type_name) \ + COGL_HANDLE_INTERNAL_DEFINE_WITH_CODE \ + (TypeName, type_name, \ + _cogl_texture_register_texture_type (&_cogl_##type_name##_class)) + +gboolean +_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); + +GLenum +_cogl_texture_get_gl_format (CoglTexture *texture); + +void +_cogl_texture_set_wrap_mode_parameters (CoglTexture *texture, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p); + + +void +_cogl_texture_set_filters (CoglTexture *texture, + GLenum min_filter, + GLenum mag_filter); + +void +_cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags); + +void +_cogl_texture_ensure_non_quad_rendering (CoglTexture *texture); + +/* Utility function to determine which pixel format to use when + dst_format is COGL_PIXEL_FORMAT_ANY. If dst_format is not ANY then + it will just be returned directly */ +CoglPixelFormat +_cogl_texture_determine_internal_format (CoglPixelFormat src_format, + CoglPixelFormat dst_format); + +/* Utility function to help uploading a bitmap. If the bitmap needs + premult conversion then it will be copied and *copied_bitmap will + be set to TRUE. Otherwise dst_bmp will be set to a shallow copy of + src_bmp. The GLenums needed for uploading are returned */ + +CoglBitmap * +_cogl_texture_prepare_for_upload (CoglBitmap *src_bmp, + CoglPixelFormat dst_format, + CoglPixelFormat *dst_format_out, + GLenum *out_glintformat, + GLenum *out_glformat, + GLenum *out_gltype); + +void +_cogl_texture_prep_gl_alignment_for_pixels_upload (int pixels_rowstride); + +void +_cogl_texture_prep_gl_alignment_for_pixels_download (int pixels_rowstride); + +/* Utility function to use as a fallback for getting the data of any + texture via the framebuffer */ + +gboolean +_cogl_texture_draw_and_read (CoglTexture *texture, + CoglBitmap *target_bmp, + GLuint target_gl_format, + GLuint target_gl_type); + +gboolean +_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); + +#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..0e95106 --- /dev/null +++ b/cogl/cogl-texture-rectangle-private.h @@ -0,0 +1,62 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#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 GL texture represented as a + CoglPixelFormat */ + CoglPixelFormat format; + /* The internal format of the GL texture represented as a GL enum */ + GLenum gl_format; + /* The texture object number */ + GLuint gl_texture; + int width; + int height; + GLenum min_filter; + GLenum mag_filter; + GLint wrap_mode_s; + GLint wrap_mode_t; + gboolean is_foreign; +}; + +CoglTextureRectangle * +_cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format); + +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..b906f58 --- /dev/null +++ b/cogl/cogl-texture-rectangle.c @@ -0,0 +1,609 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * 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-handle.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-opengl-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); + +static const CoglTextureVtable cogl_texture_rectangle_vtable; + +static gboolean +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_set_wrap_mode_parameters (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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->wrap_mode_s != wrap_mode_s || + tex_rect->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->wrap_mode_s = wrap_mode_s; + tex_rect->wrap_mode_t = wrap_mode_t; + } +} + +static void +_cogl_texture_rectangle_free (CoglTextureRectangle *tex_rect) +{ + if (!tex_rect->is_foreign) + _cogl_delete_gl_texture (tex_rect->gl_texture); + + /* Chain up */ + _cogl_texture_free (COGL_TEXTURE (tex_rect)); +} + +static gboolean +_cogl_texture_rectangle_can_create (unsigned int width, + unsigned int height, + CoglPixelFormat internal_format, + GError **error) +{ + GLenum gl_intformat; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, FALSE); + + if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE)) + { + g_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_TYPE, + "The CoglTextureRectangle feature isn't available"); + return FALSE; + } + + ctx->texture_driver->pixel_format_to_gl (internal_format, + &gl_intformat, + NULL, + &gl_type); + + /* Check that the driver can create a texture with that size */ + if (!ctx->texture_driver->size_supported (GL_TEXTURE_RECTANGLE_ARB, + gl_intformat, + gl_type, + width, + height)) + { + g_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "The requested texture size + format is unsupported"); + return FALSE; + } + + return TRUE; +} + +static CoglTextureRectangle * +_cogl_texture_rectangle_create_base (unsigned int width, + unsigned int height, + CoglPixelFormat internal_format) +{ + CoglTextureRectangle *tex_rect = g_new (CoglTextureRectangle, 1); + CoglTexture *tex = COGL_TEXTURE (tex_rect); + + _cogl_texture_init (tex, &cogl_texture_rectangle_vtable); + + tex_rect->width = width; + tex_rect->height = height; + + /* We default to GL_LINEAR for both filters */ + tex_rect->min_filter = GL_LINEAR; + tex_rect->mag_filter = GL_LINEAR; + + /* Wrap mode not yet set */ + tex_rect->wrap_mode_s = GL_FALSE; + tex_rect->wrap_mode_t = GL_FALSE; + + tex_rect->format = internal_format; + + return tex_rect; +} + +CoglTextureRectangle * +cogl_texture_rectangle_new_with_size (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + GError **error) +{ + CoglTextureRectangle *tex_rect; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + /* Since no data, we need some internal format */ + if (internal_format == COGL_PIXEL_FORMAT_ANY) + internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; + + if (!_cogl_texture_rectangle_can_create (width, height, + internal_format, error)) + return NULL; + + internal_format = ctx->texture_driver->pixel_format_to_gl (internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + tex_rect = _cogl_texture_rectangle_create_base (width, height, + internal_format); + + ctx->texture_driver->gen (GL_TEXTURE_RECTANGLE_ARB, 1, &tex_rect->gl_texture); + _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, + tex_rect->gl_texture, + tex_rect->is_foreign); + GE( ctx, glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, gl_intformat, + width, height, 0, gl_format, gl_type, NULL) ); + + return _cogl_texture_rectangle_object_new (tex_rect); +} + +CoglTextureRectangle * +_cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglTextureRectangle *tex_rect; + CoglBitmap *dst_bmp; + GLenum gl_intformat; + GLenum gl_format; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, NULL); + + _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); + + internal_format = + _cogl_texture_determine_internal_format (cogl_bitmap_get_format (bmp), + internal_format); + + if (!_cogl_texture_rectangle_can_create (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + internal_format, + NULL)) + return NULL; + + dst_bmp = _cogl_texture_prepare_for_upload (bmp, + internal_format, + &internal_format, + &gl_intformat, + &gl_format, + &gl_type); + + if (dst_bmp == NULL) + return NULL; + + tex_rect = _cogl_texture_rectangle_create_base (cogl_bitmap_get_width (bmp), + cogl_bitmap_get_height (bmp), + internal_format); + + ctx->texture_driver->gen (GL_TEXTURE_RECTANGLE_ARB, 1, &tex_rect->gl_texture); + ctx->texture_driver->upload_to_gl (GL_TEXTURE_RECTANGLE_ARB, + tex_rect->gl_texture, + FALSE, + dst_bmp, + gl_intformat, + gl_format, + gl_type); + + tex_rect->gl_format = gl_intformat; + + cogl_object_unref (dst_bmp); + + return _cogl_texture_rectangle_object_new (tex_rect); +} + +CoglTextureRectangle * +_cogl_texture_rectangle_new_from_foreign (GLuint gl_handle, + GLuint width, + GLuint height, + CoglPixelFormat format) +{ + /* NOTE: width, height and internal format are not queriable + * in GLES, hence such a function prototype. + */ + + GLenum gl_error = 0; + GLint gl_compressed = GL_FALSE; + GLenum gl_int_format = 0; + CoglTextureRectangle *tex_rect; + + _COGL_GET_CONTEXT (ctx, NULL); + + if (!ctx->texture_driver->allows_foreign_gl_target (GL_TEXTURE_RECTANGLE_ARB)) + return NULL; + + /* Make sure it is a valid GL texture object */ + if (!ctx->glIsTexture (gl_handle)) + return NULL; + + /* Make sure binding succeeds */ + while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) + ; + + _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, gl_handle, TRUE); + if (ctx->glGetError () != GL_NO_ERROR) + return NULL; + + /* Obtain texture parameters */ + +#if HAVE_COGL_GL + if (ctx->driver == COGL_DRIVER_GL) + { + 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->texture_driver->pixel_format_from_gl_internal (gl_int_format, + &format)) + return NULL; + } + else +#endif + { + /* Otherwise we'll assume we can derive the GL format from the + passed in format */ + ctx->texture_driver->pixel_format_to_gl (format, + &gl_int_format, + NULL, + NULL); + } + + /* 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. + */ + + /* Validate width and height */ + if (width <= 0 || height <= 0) + return NULL; + + /* Compressed texture images not supported */ + if (gl_compressed == GL_TRUE) + return NULL; + + /* Create new texture */ + tex_rect = _cogl_texture_rectangle_create_base (width, height, format); + + /* Setup bitmap info */ + tex_rect->is_foreign = TRUE; + + tex_rect->format = format; + + tex_rect->gl_texture = gl_handle; + tex_rect->gl_format = gl_int_format; + + /* Unknown filter */ + tex_rect->min_filter = GL_FALSE; + tex_rect->mag_filter = GL_FALSE; + + return _cogl_texture_rectangle_handle_new (tex_rect); +} + +static int +_cogl_texture_rectangle_get_max_waste (CoglTexture *tex) +{ + return -1; +} + +static gboolean +_cogl_texture_rectangle_is_sliced (CoglTexture *tex) +{ + return FALSE; +} + +static gboolean +_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) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + + *s *= tex_rect->width; + *t *= tex_rect->height; +} + +static CoglTransformResult +_cogl_texture_rectangle_transform_quad_coords_to_gl (CoglTexture *tex, + float *coords) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + gboolean 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_rect->height : tex_rect->width; + } + + return (need_repeat ? COGL_TRANSFORM_SOFTWARE_REPEAT + : COGL_TRANSFORM_NO_REPEAT); +} + +static gboolean +_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_set_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (min_filter == tex_rect->min_filter + && mag_filter == tex_rect->mag_filter) + return; + + /* Rectangle textures don't support mipmapping */ + g_assert (min_filter == GL_LINEAR || min_filter == GL_NEAREST); + + /* Store new values */ + tex_rect->min_filter = min_filter; + tex_rect->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) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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 gboolean +_cogl_texture_rectangle_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + GLenum gl_format; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, FALSE); + + bmp = _cogl_texture_prepare_for_upload (bmp, + cogl_texture_get_format (tex), + NULL, + NULL, + &gl_format, + &gl_type); + + /* Send data to GL */ + ctx->texture_driver->upload_subregion_to_gl (GL_TEXTURE_RECTANGLE_ARB, + tex_rect->gl_texture, + FALSE, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + bmp, + gl_format, + gl_type); + + cogl_object_unref (bmp); + + return TRUE; +} + +static gboolean +_cogl_texture_rectangle_get_data (CoglTexture *tex, + CoglPixelFormat format, + unsigned int rowstride, + guint8 *data) +{ + CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex); + int bpp; + GLenum gl_format; + GLenum gl_type; + + _COGL_GET_CONTEXT (ctx, FALSE); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + + ctx->texture_driver->pixel_format_to_gl (format, + NULL, /* internal format */ + &gl_format, + &gl_type); + + ctx->texture_driver->prep_gl_for_pixels_download (rowstride, 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 (GL_TEXTURE_RECTANGLE_ARB, + gl_format, + gl_type, + data); +} + +static CoglPixelFormat +_cogl_texture_rectangle_get_format (CoglTexture *tex) +{ + return COGL_TEXTURE_RECTANGLE (tex)->format; +} + +static GLenum +_cogl_texture_rectangle_get_gl_format (CoglTexture *tex) +{ + return COGL_TEXTURE_RECTANGLE (tex)->gl_format; +} + +static int +_cogl_texture_rectangle_get_width (CoglTexture *tex) +{ + return COGL_TEXTURE_RECTANGLE (tex)->width; +} + +static int +_cogl_texture_rectangle_get_height (CoglTexture *tex) +{ + return COGL_TEXTURE_RECTANGLE (tex)->height; +} + +static gboolean +_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 = + { + _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_set_filters, + _cogl_texture_rectangle_pre_paint, + _cogl_texture_rectangle_ensure_non_quad_rendering, + _cogl_texture_rectangle_set_wrap_mode_parameters, + _cogl_texture_rectangle_get_format, + _cogl_texture_rectangle_get_gl_format, + _cogl_texture_rectangle_get_width, + _cogl_texture_rectangle_get_height, + _cogl_texture_rectangle_get_type, + _cogl_texture_rectangle_is_foreign + }; diff --git a/cogl/cogl-texture-rectangle.h b/cogl/cogl-texture-rectangle.h new file mode 100644 index 0000000..927bb93 --- /dev/null +++ b/cogl/cogl-texture-rectangle.h @@ -0,0 +1,118 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_TEXURE_RECTANGLE_H +#define __COGL_TEXURE_RECTANGLE_H + +#include "cogl-context.h" + +G_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) + +#define cogl_is_texture_rectangle cogl_is_texture_rectangle_EXP +/** + * 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. + */ +gboolean +cogl_is_texture_rectangle (void *object); + +#define cogl_texture_rectangle_new_with_size \ + cogl_texture_rectangle_new_with_size_EXP +/** + * cogl_texture_rectangle_new_with_size: + * @context: A #CoglContext pointer + * @width: The texture width to allocate + * @height: The texture height to allocate + * @internal_format: The desired internal texture format + * @error: An optional GError pointer for reporting exceptions + * + * Allocates a new #CoglRectangle texture with a given @width, @height + * and @internal_format. This texture is a low-level texture that + * the GPU can sample from directly unlike high-level textures such + * as #CoglTexture2DSliced and #CoglAtlasTexture. + * + * 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(). + * + * Returns: A pointer to a newly allocated #CoglRectangle texture + * or if the size was too large or there wasn't enough memory + * %NULL is returned and @error set. + * + * Since: 1.10 + * Stability: unstable + */ +CoglTextureRectangle * +cogl_texture_rectangle_new_with_size (CoglContext *ctx, + int width, + int height, + CoglPixelFormat internal_format, + GError **error); + +G_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..ab521bc --- /dev/null +++ b/cogl/cogl-texture.c @@ -0,0 +1,1397 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * Copyright (C) 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, see . + * + * + * + * Authors: + * Matthew Allum + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-internal.h" +#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-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-handle.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 +#include +#include + +GQuark +cogl_texture_error_quark (void) +{ + return g_quark_from_static_string ("cogl-texture-error-quark"); +} + +/* XXX: + * The CoglHandle macros don't support any form of inheritance, so for + * now we implement the CoglHandle support for the CoglTexture + * abstract class manually. + */ + +void +_cogl_texture_register_texture_type (const CoglObjectClass *klass) +{ + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + ctxt->texture_types = g_slist_prepend (ctxt->texture_types, (void *) klass); +} + +gboolean +cogl_is_texture (void *object) +{ + CoglObject *obj = (CoglObject *)object; + GSList *l; + + _COGL_GET_CONTEXT (ctxt, FALSE); + + if (object == NULL) + return FALSE; + + for (l = ctxt->texture_types; l; l = l->next) + if (l->data == obj->klass) + return TRUE; + + return FALSE; +} + +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); +} + +void +_cogl_texture_init (CoglTexture *texture, + const CoglTextureVtable *vtable) +{ + texture->vtable = vtable; + texture->framebuffers = NULL; +} + +void +_cogl_texture_free (CoglTexture *texture) +{ + g_free (texture); +} + +static gboolean +_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)); +} + +CoglPixelFormat +_cogl_texture_determine_internal_format (CoglPixelFormat src_format, + CoglPixelFormat dst_format) +{ + /* If the application hasn't specified a specific format then we'll + * pick the most appropriate. By default Cogl will use a + * premultiplied internal format. Later we will add control over + * this. */ + if (dst_format == COGL_PIXEL_FORMAT_ANY) + { + if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (src_format)) + return src_format | COGL_PREMULT_BIT; + else + return src_format; + } + else + return dst_format; +} + +CoglBitmap * +_cogl_texture_prepare_for_upload (CoglBitmap *src_bmp, + CoglPixelFormat dst_format, + CoglPixelFormat *dst_format_out, + GLenum *out_glintformat, + GLenum *out_glformat, + GLenum *out_gltype) +{ + CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp); + CoglBitmap *dst_bmp; + + _COGL_GET_CONTEXT (ctx, NULL); + + dst_format = _cogl_texture_determine_internal_format (src_format, + dst_format); + + /* 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 (ctx->driver == COGL_DRIVER_GL) + { + /* If the source format does not have the same premult flag as the + dst format then we need to copy and convert it */ + if (_cogl_texture_needs_premult_conversion (src_format, + dst_format)) + { + dst_bmp = _cogl_bitmap_convert (src_bmp, + src_format ^ COGL_PREMULT_BIT); + + if (dst_bmp == NULL) + return NULL; + } + else + dst_bmp = cogl_object_ref (src_bmp); + + /* Use the source format from the src bitmap type and the internal + format from the dst format type so that GL can do the + conversion */ + ctx->texture_driver->pixel_format_to_gl (src_format, + NULL, /* internal format */ + out_glformat, + out_gltype); + ctx->texture_driver->pixel_format_to_gl (dst_format, + out_glintformat, + NULL, + NULL); + + } + else + { + CoglPixelFormat closest_format; + + closest_format = ctx->texture_driver->pixel_format_to_gl (dst_format, + out_glintformat, + out_glformat, + out_gltype); + + if (closest_format != src_format) + dst_bmp = _cogl_bitmap_convert (src_bmp, closest_format); + else + dst_bmp = cogl_object_ref (src_bmp); + } + + if (dst_format_out) + *dst_format_out = dst_format; + + return dst_bmp; +} + +void +_cogl_texture_prep_gl_alignment_for_pixels_upload (int pixels_rowstride) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!(pixels_rowstride & 0x7)) + GE( ctx, glPixelStorei (GL_UNPACK_ALIGNMENT, 8) ); + else if (!(pixels_rowstride & 0x3)) + GE( ctx, glPixelStorei (GL_UNPACK_ALIGNMENT, 4) ); + else if (!(pixels_rowstride & 0x1)) + GE( ctx, glPixelStorei (GL_UNPACK_ALIGNMENT, 2) ); + else + GE( ctx, glPixelStorei (GL_UNPACK_ALIGNMENT, 1) ); +} + +void +_cogl_texture_prep_gl_alignment_for_pixels_download (int pixels_rowstride) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!(pixels_rowstride & 0x7)) + GE( ctx, glPixelStorei (GL_PACK_ALIGNMENT, 8) ); + else if (!(pixels_rowstride & 0x3)) + GE( ctx, glPixelStorei (GL_PACK_ALIGNMENT, 4) ); + else if (!(pixels_rowstride & 0x1)) + GE( ctx, glPixelStorei (GL_PACK_ALIGNMENT, 2) ); + else + GE( ctx, glPixelStorei (GL_PACK_ALIGNMENT, 1) ); +} + +/* FIXME: wrap modes should be set on pipelines not textures */ +void +_cogl_texture_set_wrap_mode_parameters (CoglTexture *texture, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + texture->vtable->set_wrap_mode_parameters (texture, + wrap_mode_s, + wrap_mode_t, + wrap_mode_p); +} + +CoglTexture * +cogl_texture_new_with_size (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglTexture *tex; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + /* First try creating a fast-path non-sliced texture */ + tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, + width, height, + internal_format, + NULL)); + + /* If it fails resort to sliced textures */ + if (tex == NULL) + { + 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, + internal_format, + NULL)); + } + + return tex; +} + +CoglTexture * +cogl_texture_new_from_data (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat format, + CoglPixelFormat internal_format, + unsigned int rowstride, + const guint8 *data) +{ + CoglBitmap *bmp; + CoglTexture *tex; + + _COGL_GET_CONTEXT (ctx, NULL); + + if (format == COGL_PIXEL_FORMAT_ANY) + return NULL; + + if (data == NULL) + return 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, + (guint8 *) data); + + tex = cogl_texture_new_from_bitmap (bmp, flags, internal_format); + + cogl_object_unref (bmp); + + return tex; +} + +CoglTexture * +cogl_texture_new_from_bitmap (CoglBitmap *bitmap, + CoglTextureFlags flags, + CoglPixelFormat internal_format) +{ + CoglTexture *tex; + + /* First try putting the texture in the atlas */ + if ((tex = _cogl_atlas_texture_new_from_bitmap (bitmap, + flags, + internal_format))) + return tex; + + /* If that doesn't work try a fast path 2D texture */ + if ((tex = _cogl_texture_2d_new_from_bitmap (bitmap, + flags, + internal_format, + NULL))) + return tex; + + /* Otherwise create a sliced texture */ + return + COGL_TEXTURE (_cogl_texture_2d_sliced_new_from_bitmap (bitmap, + flags, + internal_format)); +} + +CoglTexture * +cogl_texture_new_from_file (const char *filename, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + GError **error) +{ + CoglBitmap *bmp; + CoglTexture *texture = NULL; + CoglPixelFormat src_format; + + _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); + + bmp = cogl_bitmap_new_from_file (filename, error); + if (bmp == NULL) + return NULL; + + src_format = cogl_bitmap_get_format (bmp); + + /* We know that the bitmap data is solely owned by this function so + we can do the premult conversion in place. This avoids having to + copy the bitmap which will otherwise happen in + _cogl_texture_prepare_for_upload */ + internal_format = + _cogl_texture_determine_internal_format (src_format, internal_format); + if (!_cogl_texture_needs_premult_conversion (src_format, internal_format) || + _cogl_bitmap_convert_premult_status (bmp, src_format ^ COGL_PREMULT_BIT)) + texture = cogl_texture_new_from_bitmap (bmp, flags, internal_format); + + 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) +{ +#if HAVE_COGL_GL + if (gl_target == GL_TEXTURE_RECTANGLE_ARB) + { + CoglTextureRectangle *texture_rectangle; + CoglSubTexture *sub_texture; + + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + + 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 COGL_INVALID_HANDLE; + } + + texture_rectangle = _cogl_texture_rectangle_new_from_foreign (gl_handle, + width, + height, + 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) + return COGL_TEXTURE (_cogl_texture_2d_sliced_new_from_foreign (gl_handle, + gl_target, + width, + height, + x_pot_waste, + y_pot_waste, + format)); + else + { + _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); + return COGL_TEXTURE (cogl_texture_2d_new_from_foreign (ctx, + gl_handle, + width, + height, + format, + NULL)); + } +} + +gboolean +_cogl_texture_is_foreign (CoglTexture *texture) +{ + if (texture->vtable->is_foreign) + return texture->vtable->is_foreign (texture); + else + return FALSE; +} + +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)); +} + +unsigned int +cogl_texture_get_width (CoglTexture *texture) +{ + return texture->vtable->get_width (texture); +} + +unsigned int +cogl_texture_get_height (CoglTexture *texture) +{ + return texture->vtable->get_height (texture); +} + +CoglPixelFormat +cogl_texture_get_format (CoglTexture *texture) +{ + return texture->vtable->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)); +} + +int +cogl_texture_get_max_waste (CoglTexture *texture) +{ + return texture->vtable->get_max_waste (texture); +} + +gboolean +cogl_texture_is_sliced (CoglTexture *texture) +{ + 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] + */ +gboolean +_cogl_texture_can_hardware_repeat (CoglTexture *texture) +{ + 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); +} + +GLenum +_cogl_texture_get_gl_format (CoglTexture *texture) +{ + return texture->vtable->get_gl_format (texture); +} + +gboolean +cogl_texture_get_gl_texture (CoglTexture *texture, + GLuint *out_gl_handle, + GLenum *out_gl_target) +{ + 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_set_filters (CoglTexture *texture, + GLenum min_filter, + GLenum mag_filter) +{ + texture->vtable->set_filters (texture, min_filter, mag_filter); +} + +void +_cogl_texture_pre_paint (CoglTexture *texture, CoglTexturePrePaintFlags flags) +{ + texture->vtable->pre_paint (texture, flags); +} + +void +_cogl_texture_ensure_non_quad_rendering (CoglTexture *texture) +{ + texture->vtable->ensure_non_quad_rendering (texture); +} + +gboolean +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 *bmp) +{ + gboolean ret; + + _COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_width (bmp) - src_x) + >= dst_width, FALSE); + _COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_height (bmp) - src_y) + >= dst_height, FALSE); + + /* Shortcut out early if the image is empty */ + if (dst_width == 0 || dst_height == 0) + return TRUE; + + /* 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. */ + + ret = texture->vtable->set_region (texture, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + bmp); + + return ret; +} + +gboolean +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 guint8 *data) +{ + CoglBitmap *source_bmp; + gboolean ret; + + _COGL_GET_CONTEXT (ctx, FALSE); + + _COGL_RETURN_VAL_IF_FAIL ((width - src_x) >= dst_width, FALSE); + _COGL_RETURN_VAL_IF_FAIL ((height - src_y) >= dst_height, FALSE); + + /* Check for valid format */ + if (format == COGL_PIXEL_FORMAT_ANY) + return 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, + (guint8 *) data); + + ret = cogl_texture_set_region_from_bitmap (texture, + src_x, src_y, + dst_x, dst_y, + dst_width, dst_height, + source_bmp); + + cogl_object_unref (source_bmp); + + return ret; +} + +/* 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 void +do_texture_draw_and_read (CoglTexture *texture, + CoglBitmap *target_bmp, + float *viewport) +{ + float rx1, ry1; + float rx2, ry2; + float tx1, ty1; + float tx2, ty2; + int bw, bh; + CoglBitmap *rect_bmp; + unsigned int tex_width, tex_height; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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_rectangle_with_texture_coords (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); + + cogl_framebuffer_read_pixels_into_bitmap + (cogl_get_draw_framebuffer (), + viewport[0], viewport[1], + COGL_READ_PIXELS_COLOR_BUFFER, + rect_bmp); + + /* Copy to target bitmap */ + _cogl_bitmap_copy_subregion (rect_bmp, + target_bmp, + 0,0, + rx1,ry1, + width, + height); + + /* Free temp bitmap */ + cogl_object_unref (rect_bmp); + } + } +} + +/* 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. + */ +gboolean +_cogl_texture_draw_and_read (CoglTexture *texture, + CoglBitmap *target_bmp, + GLuint target_gl_format, + GLuint target_gl_type) +{ + int bpp; + CoglFramebuffer *framebuffer; + float viewport[4]; + CoglBitmap *alpha_bmp; + 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); + + _COGL_GET_CONTEXT (ctx, FALSE); + + bpp = _cogl_pixel_format_get_bytes_per_pixel (COGL_PIXEL_FORMAT_RGBA_8888); + + framebuffer = cogl_get_draw_framebuffer (); + /* Viewport needs to have some size and be inside the window for this */ + cogl_framebuffer_get_viewport4fv (framebuffer, viewport); + if (viewport[0] < 0 || viewport[1] < 0 || + viewport[2] <= 0 || viewport[3] <= 0) + return FALSE; + + /* Setup orthographic projection into current viewport (0,0 in top-left + * corner to draw the texture upside-down so we match the way cogl_read_pixels + * works) + */ + + _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_push_source (ctx->texture_download_pipeline, FALSE); + + 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); + + do_texture_draw_and_read (texture, target_bmp, viewport); + + /* Check whether texture has alpha and framebuffer not */ + /* FIXME: For some reason even if ALPHA_BITS is 8, the framebuffer + still doesn't seem to have an alpha buffer. This might be just + a PowerVR issue. + GLint r_bits, g_bits, b_bits, a_bits; + GE( ctx, glGetIntegerv (GL_ALPHA_BITS, &a_bits) ); + GE( ctx, glGetIntegerv (GL_RED_BITS, &r_bits) ); + GE( ctx, glGetIntegerv (GL_GREEN_BITS, &g_bits) ); + GE( ctx, glGetIntegerv (GL_BLUE_BITS, &b_bits) ); + printf ("R bits: %d\n", r_bits); + printf ("G bits: %d\n", g_bits); + printf ("B bits: %d\n", b_bits); + printf ("A bits: %d\n", a_bits); */ + if ((cogl_texture_get_format (texture) & COGL_A_BIT)/* && a_bits == 0*/) + { + guint8 *srcdata; + guint8 *dstdata; + guint8 *srcpixel; + guint8 *dstpixel; + int x,y; + int alpha_rowstride = bpp * target_width; + + if ((dstdata = _cogl_bitmap_map (target_bmp, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD)) == NULL) + return FALSE; + + /* Create temp bitmap for alpha values */ + alpha_bmp = + _cogl_bitmap_new_with_malloc_buffer (ctx, + target_width, + target_height, + COGL_PIXEL_FORMAT_RGBA_8888); + + /* Draw alpha values into RGB channels */ + cogl_pipeline_set_layer_combine (ctx->texture_download_pipeline, + 0, /* layer */ + "RGBA = REPLACE (TEXTURE[A])", + NULL); + + do_texture_draw_and_read (texture, alpha_bmp, viewport); + + /* Copy temp R to target A */ + + srcdata = _cogl_bitmap_map (alpha_bmp, + COGL_BUFFER_ACCESS_READ, + 0 /* hints */); + + for (y=0; yvtable->get_data (texture, + dst_format, + full_rowstride, + full_bits)) + { + guint8 *dst = dst_bits; + guint8 *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 +{ + int orig_width; + int orig_height; + CoglBitmap *target_bmp; + guint8 *target_bits; + gboolean success; +} CoglTextureGetData; + +static void +texture_get_cb (CoglTexture *texture, + const float *subtexture_coords, + const float *virtual_coords, + void *user_data) +{ + CoglTextureGetData *tg_data = user_data; + CoglPixelFormat format = cogl_bitmap_get_format (tg_data->target_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); + unsigned int rowstride = cogl_bitmap_get_rowstride (tg_data->target_bmp); + int subtexture_width = cogl_texture_get_width (texture); + int subtexture_height = cogl_texture_get_height (texture); + + 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]); + + guint8 *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 (texture->vtable->get_data (texture, + format, + rowstride, + dst_bits)) + return; + } + + /* Next best option is a FBO and glReadPixels */ + if (get_texture_bits_via_offscreen (texture, + x_in_subtexture, y_in_subtexture, + width, height, + dst_bits, + rowstride, + format)) + return; + + /* Getting ugly: read the entire texture, copy out the part we want */ + if (get_texture_bits_via_copy (texture, + x_in_subtexture, y_in_subtexture, + width, height, + dst_bits, + rowstride, + 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, + guint8 *data) +{ + 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; + + CoglTextureGetData tg_data; + + _COGL_GET_CONTEXT (ctx, 0); + + 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 (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)); + + /* 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); + + tg_data.orig_width = tex_width; + tg_data.orig_height = tex_height; + tg_data.target_bmp = target_bmp; + tg_data.target_bits = _cogl_bitmap_map (target_bmp, COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + if (tg_data.target_bits == NULL) + { + cogl_object_unref (target_bmp); + return 0; + } + 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); + + /* 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) + _cogl_texture_draw_and_read (texture, target_bmp, + closest_gl_format, + closest_gl_type); + + /* Was intermediate used? */ + if (closest_format != format) + { + CoglBitmap *new_bmp; + gboolean result; + + /* 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); + + if (!result) + /* 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]; + + /* 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; + } + else + { + slice_coords[1] = iter_y.intersect_start; + slice_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; + float span_virtual_coords[4]; + + if (iter_x.flipped) + { + slice_coords[0] = iter_x.intersect_end; + slice_coords[2] = iter_x.intersect_start; + } + else + { + slice_coords[0] = iter_x.intersect_start; + slice_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_y_spans + iter_x.index]; + + span_virtual_coords[0] = iter_x.intersect_start; + span_virtual_coords[1] = iter_y.intersect_start; + span_virtual_coords[2] = iter_x.intersect_end; + span_virtual_coords[3] = iter_y.intersect_end; + + callback (COGL_TEXTURE (span_tex), + slice_coords, + span_virtual_coords, + user_data); + } + } +} + diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h new file mode 100644 index 0000000..4eeffb5 --- /dev/null +++ b/cogl/cogl-texture.h @@ -0,0 +1,524 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_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. + */ +typedef struct _CoglTexture CoglTexture; + +#include +#include +#if defined (COGL_ENABLE_EXPERIMENTAL_API) +#include +#endif +#include + +G_BEGIN_DECLS + +/** + * SECTION:cogl-texture + * @short_description: Fuctions 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(X) ((CoglTexture *)X) + +#define COGL_TEXTURE_MAX_WASTE 127 + +/** + * COGL_TEXTURE_ERROR: + * + * #GError domain for texture errors. + * + * Since: 2.0 + * Stability: Unstable + */ +#define COGL_TEXTURE_ERROR (cogl_texture_error_quark ()) + + +/** + * CoglTextureError: + * @COGL_TEXTURE_ERROR_SIZE: Unsupported size + * + * Error codes that can be thrown when allocating textures. + * + * Since: 2.0 + * 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; + +GQuark cogl_texture_error_quark (void); + +/** + * 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: A newly created #CoglTexture or %NULL on failure + * + * Since: 0.8 + */ +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 #GError or %NULL + * + * Creates a #CoglTexture from an image file. + * + * Return value: A newly created #CoglTexture or %NULL on failure + * + * Since: 0.8 + */ +CoglTexture * +cogl_texture_new_from_file (const char *filename, + CoglTextureFlags flags, + CoglPixelFormat internal_format, + GError **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: A newly created #CoglTexture or %NULL on failure + * + * Since: 0.8 + */ +CoglTexture * +cogl_texture_new_from_data (unsigned int width, + unsigned int height, + CoglTextureFlags flags, + CoglPixelFormat format, + CoglPixelFormat internal_format, + unsigned int rowstride, + const guint8 *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: A newly created #CoglTexture or %NULL on failure + * + * Since: 0.8 + */ +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_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: A newly created #CoglTexture or %NULL on failure + * + * Since: 1.0 + */ +CoglTexture * +cogl_texture_new_from_bitmap (CoglBitmap *bitmap, + CoglTextureFlags flags, + CoglPixelFormat internal_format); + +/** + * cogl_is_texture: + * @object: A #CoglObject pointer + * + * Gets whether the given object references a texture object. + * + * Return value: %TRUE if the handle references a texture, and + * %FALSE otherwise + */ +gboolean +cogl_is_texture (void *object); + +/** + * 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_format: + * @texture a #CoglTexture pointer. + * + * Queries the #CoglPixelFormat of a cogl texture. + * + * Return value: the #CoglPixelFormat of the GPU side texture + */ +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. + */ +unsigned int +cogl_texture_get_rowstride (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 + */ +gboolean +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 + */ +gboolean +cogl_texture_get_gl_texture (CoglTexture *texture, + GLuint *out_gl_handle, + GLenum *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, + guint8 *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 + */ +gboolean +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 guint8 *data); + +#if defined (COGL_ENABLE_EXPERIMENTAL_API) + +#define cogl_texture_set_region_from_bitmap \ + cogl_texture_set_region_from_bitmap_EXP +/** + * 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 + */ +gboolean +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_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: A newly created #CoglTexture or %NULL on failure + * Since: 1.2 + */ +CoglTexture * +cogl_texture_new_from_sub_texture (CoglTexture *full_texture, + int sub_x, + int sub_y, + int sub_width, + int sub_height); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * cogl_texture_ref: + * @texture: a #CoglTexture. + * + * Increment the reference count for a cogl texture. + * + * Deprecated: 1.2: Use cogl_object_ref() instead + * + * Return value: the @texture pointer. + */ +void * +cogl_texture_ref (void *texture) G_GNUC_DEPRECATED; + +/** + * cogl_texture_unref: + * @texture: a #CoglTexture. + * + * Decrement the reference count for a cogl texture. + * + * Deprecated: 1.2: Use cogl_object_unref() instead + */ +void +cogl_texture_unref (void *texture) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +G_END_DECLS + +#endif /* __COGL_TEXTURE_H__ */ diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h new file mode 100644 index 0000000..92c5e9a --- /dev/null +++ b/cogl/cogl-types.h @@ -0,0 +1,831 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_TYPES_H__ +#define __COGL_TYPES_H__ + +#include + +#include + +G_BEGIN_DECLS + +/* 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 CLUTTER_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 gpointer 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 + +#define COGL_TYPE_HANDLE (cogl_handle_get_type ()) +GType +cogl_handle_get_type (void) G_GNUC_CONST; + +/** + * 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); + +/** + * cogl_object_ref: (skip) + * @object: a #CoglObject + * + * Increases the reference count of @handle 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); + +/** + * 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 gint32 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 gint32 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) + +/* XXX: Notes to those adding new formats here... + * + * First this diagram outlines how we allocate the 32bits of a + * CoglPixelFormat currently... + * + * 4 bits for flags + * |--| + * enum unused 4 bits for the bytes-per-pixel + * and component alignment info + * |------| |---------------| |--| + * 00000000 xxxxxxxx xxxxxxxx PFBA0000 + * ^ 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 = undefined + * 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_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_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) +} 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. + * + * 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) +} 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: + * + * 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 >*/ + guint8 COGL_PRIVATE (red); + guint8 COGL_PRIVATE (green); + guint8 COGL_PRIVATE (blue); + + guint8 COGL_PRIVATE (alpha); + + /* padding in case we want to change to floats at + * some point */ + guint32 COGL_PRIVATE (padding0); + guint32 COGL_PRIVATE (padding1); + guint32 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: + * + * #GError 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; + +GQuark +cogl_blend_string_error_quark (void); + +#define COGL_ERROR (_cogl_error_quark ()) + +/** + * CoglError: + * @COGL_ERROR_UNSUPPORTED: You tried to use a feature or + * configuration not currently available. + * @COGL_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_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_get_features(). This could happen if you create + * a 2d texture with a non-power-of-two size when + * %COGL_FEATURE_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_ERROR_UNSUPPORTED, + COGL_ERROR_NO_MEMORY +} CoglError; + +GQuark +_cogl_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_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_material_set_depth_test_function(). + * + * The test is only done when depth testing is explicitly enabled. (See + * cogl_material_set_depth_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_NOT_FOUND, + COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN +} 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 #CoglFilterFunc function. + * + * 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, + + 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_read_pixels() + * + * Since: 1.0 + */ +typedef enum { /*< prefix=COGL_READ_PIXELS >*/ + COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0 +} CoglReadPixelsFlags; + +G_END_DECLS + +#endif /* __COGL_TYPES_H__ */ diff --git a/cogl/cogl-util.c b/cogl/cogl-util.c new file mode 100644 index 0000000..0b1b4b7 --- /dev/null +++ b/cogl/cogl-util.c @@ -0,0 +1,255 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#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, + gboolean check_bgr, + gboolean 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, + gboolean 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; +} + +#endif /* _COGL_IN_TEST_BITMASK */ diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h new file mode 100644 index 0000000..d657c76 --- /dev/null +++ b/cogl/cogl-util.h @@ -0,0 +1,209 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_UTIL_H +#define __COGL_UTIL_H + +#include +#include + +#include +#include "cogl-types.h" + +#ifndef COGL_HAS_GLIB_SUPPORT +#include +#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 gboolean +cogl_util_float_signbit (float x) +{ + static const union { float f; guint32 i; } negative_one = { -1.0f }; + static const union { float f; guint32 i; } positive_one = { +1.0f }; + union { float f; guint32 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 gboolean +_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, + void *key, + size_t bytes) +{ + 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 +#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 */ + +#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 +#define _COGL_RETURN_IF_FAIL(EXPR) do { \ + if (!(EXPR)) \ + { \ + fprintf (stderr, "file %s: line %d: assertion `%s' failed", \ + __FILE__, \ + __LINE__, \ + #EXPR); \ + return; \ + }; \ + } while(0) +#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) do { \ + if (!(EXPR)) \ + { \ + fprintf (stderr, "file %s: line %d: assertion `%s' failed", \ + __FILE__, \ + __LINE__, \ + #EXPR); \ + return (VAL); \ + }; \ + } while(0) +#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); + +#endif /* __COGL_UTIL_H */ diff --git a/cogl/cogl-vector.c b/cogl/cogl-vector.c new file mode 100644 index 0000000..818d6a5 --- /dev/null +++ b/cogl/cogl-vector.c @@ -0,0 +1,295 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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. + * + * 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); +} + +gboolean +cogl_vector3_equal (gconstpointer v1, gconstpointer 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]; +} + +gboolean +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; +} + +gboolean +cogl_vector4_equal (gconstpointer *v0, gconstpointer *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..c6824d6 --- /dev/null +++ b/cogl/cogl-vector.h @@ -0,0 +1,349 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_VECTOR_H +#define __COGL_VECTOR_H + +#include + +G_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 + */ +gboolean +cogl_vector3_equal (gconstpointer v1, gconstpointer 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 + */ +gboolean +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_vector_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. + * + * 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); + +G_END_DECLS + +#endif /* __COGL_VECTOR_H */ + diff --git a/cogl/cogl-vertex-buffer-private.h b/cogl/cogl-vertex-buffer-private.h new file mode 100644 index 0000000..a4143d2 --- /dev/null +++ b/cogl/cogl-vertex-buffer-private.h @@ -0,0 +1,158 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#ifndef __COGL_VERTEX_BUFFER_H +#define __COGL_VERTEX_BUFFER_H + +#include "cogl-handle.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; + guint8 id; + GQuark name; + char *name_without_detail; + union _u + { + const void *pointer; + size_t vbo_offset; + } u; + CoglAttributeType type; + size_t span_bytes; + guint16 stride; + guint8 n_components; + guint8 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 */ + + gboolean dirty_attributes; + + CoglPrimitive *primitive; + +} CoglVertexBuffer; + +#endif /* __COGL_VERTEX_BUFFER_H */ + diff --git a/cogl/cogl-vertex-buffer.c b/cogl/cogl-vertex-buffer.c new file mode 100644 index 0000000..36c89e2 --- /dev/null +++ b/cogl/cogl-vertex-buffer.c @@ -0,0 +1,1787 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + * + * 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-internal.h" +#include "cogl-util.h" +#include "cogl-context-private.h" +#include "cogl-handle.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-journal-private.h" +#include "cogl1-context.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, + guint8 n_components, + guint8 *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, + guint8 n_components, + guint8 *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 gboolean +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, + guint8 n_components, + CoglAttributeType type, + gboolean normalized, + guint16 stride, + const void *pointer) +{ + CoglVertexBuffer *buffer; + char *cogl_attribute_name; + GQuark name_quark; + gboolean modifying_an_attrib = FALSE; + CoglVertexBufferAttrib *attribute; + CoglVertexBufferAttribFlags flags = 0; + guint8 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, + gboolean 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 gboolean +upload_multipack_vbo_via_map_buffer (CoglVertexBufferVBO *cogl_vbo) +{ + GList *tmp; + unsigned int offset = 0; + guint8 *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; + gboolean 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 gboolean +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; + gboolean 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_framebuffer_draw_primitive (cogl_get_draw_framebuffer (), + pipeline_priv->real_source, + buffer->primitive, + 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/cogl-vertex-buffer.h b/cogl/cogl-vertex-buffer.h new file mode 100644 index 0000000..631ba09 --- /dev/null +++ b/cogl/cogl-vertex-buffer.h @@ -0,0 +1,409 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Robert Bragg + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_VERTEX_BUFFER_H__ +#define __COGL_VERTEX_BUFFER_H__ + +#include +#include +#include + +G_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 + */ +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 + */ +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) + */ +void +cogl_vertex_buffer_add (CoglHandle handle, + const char *attribute_name, + guint8 n_components, + CoglAttributeType type, + gboolean normalized, + guint16 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. + */ +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. + */ +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. + */ +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 + */ +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. + */ +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(). + */ +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 + */ +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. + */ +void +cogl_vertex_buffer_draw_elements (CoglHandle handle, + CoglVerticesMode mode, + CoglHandle indices, + int min_index, + int max_index, + int indices_offset, + int count); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * cogl_vertex_buffer_ref: + * @handle: a @CoglHandle. + * + * Increment the reference count for a vertex buffer + * + * Return value: the @handle. + * + * Deprecated: 1.2: Use cogl_handle_ref() instead + */ +CoglHandle +cogl_vertex_buffer_ref (CoglHandle handle) G_GNUC_DEPRECATED; + +/** + * cogl_vertex_buffer_unref: + * @handle: a @CoglHandle. + * + * Decrement the reference count for a vertex buffer + * + * Deprecated: 1.2: Use cogl_handle_unref() instead + */ +void +cogl_vertex_buffer_unref (CoglHandle handle) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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. + */ +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 + */ +gboolean +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 + */ +gboolean +cogl_is_vertex_buffer_indices (CoglHandle handle); + +G_END_DECLS + +#endif /* __COGL_VERTEX_BUFFER_H__ */ diff --git a/cogl/cogl-wayland-client.h b/cogl/cogl-wayland-client.h new file mode 100644 index 0000000..3f290dc --- /dev/null +++ b/cogl/cogl-wayland-client.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see + * . + * + */ + +#ifndef __COGL_WAYLAND_CLIENT_H +#define __COGL_WAYLAND_CLIENT_H + +#include + +#define __COGL_H_INSIDE__ +#include + +#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..68fa774 --- /dev/null +++ b/cogl/cogl-wayland-renderer.h @@ -0,0 +1,164 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_WAYLAND_RENDERER_H__ +#define __COGL_WAYLAND_RENDERER_H__ + +#include +#include + +#include + +G_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. + * + * If you use this API you must also explicitly set foreign + * Wayland compositor and shell objects using the + * cogl_wayland_renderer_set_foreign_compositor() and + * cogl_wayland_renderer_set_foreign_shell() respectively. This ie + * because Wayland doesn't currently provide a way to retrospectively + * query these interfaces so the expectation is that if you have taken + * ownership of the display then you will also have been notified of + * the compositor and shell interfaces which Cogl needs to use. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_wayland_renderer_set_foreign_display (CoglRenderer *renderer, + struct wl_display *display); + +/** + * cogl_wayland_renderer_get_display: + * @renderer: A #CoglRenderer + * @display: A Wayland display + * + * 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_wayland_renderer_set_foreign_compositor: + * @renderer: A #CoglRenderer + * @compositor: A Wayland compositor + * + * Allows you to explicitly notify Cogl of a Wayland compositor + * interface to use. This API should be used in conjunction with + * cogl_wayland_renderer_set_foreign_display() because if you are + * connecting to a wayland compositor manually that will also mean you + * will be notified on connection of the available interfaces that + * can't be queried retrosectively with the current Wayland protocol. + * + * Since: 1.8 + * Stability: unstable + */ +void +cogl_wayland_renderer_set_foreign_compositor (CoglRenderer *renderer, + struct wl_compositor *compositor); + +/** + * cogl_wayland_renderer_get_compositor: + * @renderer: A #CoglRenderer + * + * Retrieves the Wayland compositor interface that Cogl is using. If a + * foreign compositor has been specified using + * cogl_wayland_renderer_set_foreign_compositor() then that compositor + * will be returned. If no foreign compositor has been specified then + * the compositor that Cogl is notified of 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. + * + * Since: 1.8 + * Stability: unstable + */ +struct wl_compositor * +cogl_wayland_renderer_get_compositor (CoglRenderer *renderer); + +/** + * cogl_wayland_renderer_set_foreign_shell: + * @renderer: A #CoglRenderer + * @shell: A Wayland shell + * + * Allows you to explicitly notify Cogl of a Wayland shell interface + * to use. This API should be used in conjunction with + * cogl_wayland_renderer_set_foreign_display() because if you are + * connecting to a wayland compositor manually that will also mean you + * will be notified on connection of the available interfaces that + * can't be queried retrosectively with the current Wayland protocol. + * + * Since: 1.10 + * Stability: unstable + */ +void +cogl_wayland_renderer_set_foreign_shell (CoglRenderer *renderer, + struct wl_shell *shell); + +/** + * cogl_wayland_renderer_get_shell: + * @renderer: A #CoglRenderer + * + * Retrieves the Wayland shell interface that Cogl is using. If a + * foreign shell has been specified using + * cogl_wayland_renderer_set_foreign_shell() then that shell + * will be returned. If no foreign shell has been specified then + * the shell that Cogl is notified of 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. + * + * Since: 1.10 + * Stability: unstable + */ +struct wl_shell * +cogl_wayland_renderer_get_shell (CoglRenderer *renderer); + +G_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..9c2cb46 --- /dev/null +++ b/cogl/cogl-wayland-server.h @@ -0,0 +1,70 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see + * . + * + */ + +#ifndef __COGL_WAYLAND_SERVER_H +#define __COGL_WAYLAND_SERVER_H + +#include + +#include + +#define __COGL_H_INSIDE__ +#include +#include + +G_BEGIN_DECLS + +#define cogl_wayland_texture_2d_new_from_buffer \ + cogl_wayland_texture_2d_new_from_buffer_EXP +/** + * cogl_wayland_texture_2d_new_from_buffer: + * @ctx: A #CoglContext + * @buffer: A Wayland buffer + * @error: A #GError for exceptions + * + * Uploads the given Wayland @buffer to a #CoglTexture2D. + * + * 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_buffer *buffer, + GError **error); + +G_END_DECLS + +#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..ad7e791 --- /dev/null +++ b/cogl/cogl-win32-renderer.c @@ -0,0 +1,58 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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. + * + * 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); +} + diff --git a/cogl/cogl-win32-renderer.h b/cogl/cogl-win32-renderer.h new file mode 100644 index 0000000..3b26593 --- /dev/null +++ b/cogl/cogl-win32-renderer.h @@ -0,0 +1,97 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_WIN32_RENDERER_H__ +#define __COGL_WIN32_RENDERER_H__ + +#include +#include + +G_BEGIN_DECLS + +#define cogl_win32_renderer_handle_event \ + cogl_win32_renderer_handle_event_EXP +/** + * cogl_win32_renderer_handle_event: + * @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); + +#define cogl_win32_renderer_add_filter cogl_win32_renderer_add_filter_EXP +/** + * cogl_win32_renderer_add_filter: + * + * 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); + +#define cogl_win32_renderer_remove_filter \ + cogl_win32_renderer_remove_filter_EXP +/** + * cogl_win32_renderer_remove_filter: + * + * 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); + +G_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..54a5639 --- /dev/null +++ b/cogl/cogl-x11-renderer-private.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_RENDERER_X11_PRIVATE_H +#define __COGL_RENDERER_X11_PRIVATE_H + +typedef struct _CoglX11Renderer +{ + int damage_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..c9dc03d --- /dev/null +++ b/cogl/cogl-xlib-private.h @@ -0,0 +1,47 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..d0715c1 --- /dev/null +++ b/cogl/cogl-xlib-renderer-private.h @@ -0,0 +1,95 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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" + +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; + + /* A poll FD for handling event retrieval within Cogl */ + CoglPollFD poll_fd; +} CoglXlibRenderer; + +gboolean +_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **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); + +void +_cogl_xlib_renderer_poll_get_info (CoglRenderer *renderer, + CoglPollFD **poll_fds, + int *n_poll_fds, + gint64 *timeout); + +void +_cogl_xlib_renderer_poll_dispatch (CoglRenderer *renderer, + const CoglPollFD *poll_fds, + int n_poll_fds); + +#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..1bbbe14 --- /dev/null +++ b/cogl/cogl-xlib-renderer.c @@ -0,0 +1,314 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009,2010 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-xlib-renderer.h" +#include "cogl-util.h" +#include "cogl-internal.h" +#include "cogl-object.h" + +#include "cogl-renderer-private.h" +#include "cogl-xlib-renderer-private.h" +#include "cogl-x11-renderer-private.h" +#include "cogl-winsys-private.h" + +#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, GError **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) + { + g_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; +} + +gboolean +_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + CoglX11Renderer *x11_renderer = + (CoglX11Renderer *) xlib_renderer; + int damage_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; + + xlib_renderer->trap_state = NULL; + + xlib_renderer->poll_fd.fd = ConnectionNumber (xlib_renderer->xdpy); + xlib_renderer->poll_fd.events = COGL_POLL_FD_EVENT_IN; + + register_xlib_renderer (renderer); + + return TRUE; +} + +void +_cogl_xlib_renderer_disconnect (CoglRenderer *renderer) +{ + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (renderer); + + 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); +} + +void +_cogl_xlib_renderer_poll_get_info (CoglRenderer *renderer, + CoglPollFD **poll_fds, + int *n_poll_fds, + gint64 *timeout) +{ + CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); + + if (renderer->xlib_enable_event_retrieval) + { + *n_poll_fds = 1; + *poll_fds = &xlib_renderer->poll_fd; + if (XPending (xlib_renderer->xdpy)) + *timeout = 0; + else + *timeout = -1; + } + else + { + *n_poll_fds = 0; + *poll_fds = NULL; + *timeout = -1; + } +} + +void +_cogl_xlib_renderer_poll_dispatch (CoglRenderer *renderer, + const CoglPollFD *poll_fds, + int n_poll_fds) +{ + 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); + } +} diff --git a/cogl/cogl-xlib-renderer.h b/cogl/cogl-xlib-renderer.h new file mode 100644 index 0000000..c22d2e5 --- /dev/null +++ b/cogl/cogl-xlib-renderer.h @@ -0,0 +1,155 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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(__COGL_XLIB_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_XLIB_RENDERER_H__ +#define __COGL_XLIB_RENDERER_H__ + +#include +#include + +#define __COGL_H_INSIDE__ +#include + +G_BEGIN_DECLS + +#define cogl_xlib_renderer_handle_event \ + cogl_xlib_renderer_handle_event_EXP +/* + * cogl_xlib_renderer_handle_event: + * @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); + +#define cogl_xlib_renderer_add_filter cogl_xlib_renderer_add_filter_EXP +/* + * cogl_xlib_renderer_add_filter: + * + * 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); + +#define cogl_xlib_renderer_remove_filter \ + cogl_xlib_renderer_remove_filter_EXP +/* + * cogl_xlib_renderer_remove_filter: + * + * 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); + +#define cogl_xlib_renderer_get_foreign_display \ + cogl_xlib_renderer_get_foreign_display_EXP +/* + * cogl_xlib_renderer_get_foreign_display: + * + * 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); + +#define cogl_xlib_renderer_set_foreign_display \ + cogl_xlib_renderer_set_foreign_display_EXP +/* + * cogl_xlib_renderer_set_foreign_display: + * + * 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, + gboolean enable); + +#define cogl_xlib_renderer_get_display cogl_xlib_renderer_get_display_EXP +Display * +cogl_xlib_renderer_get_display (CoglRenderer *renderer); + +G_END_DECLS + +#endif /* __COGL_XLIB_RENDERER_H__ */ diff --git a/cogl/cogl-xlib.c b/cogl/cogl-xlib.c new file mode 100644 index 0000000..6c8ebea --- /dev/null +++ b/cogl/cogl-xlib.c @@ -0,0 +1,108 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * 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. + * + * Authors: + * Robert Bragg + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#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; + + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + /* Check whether damage events are supported on this display */ + if (!XDamageQueryExtension (cogl_xlib_get_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..aeefb3d --- /dev/null +++ b/cogl/cogl-xlib.h @@ -0,0 +1,87 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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 __COGL_XLIB_H__ +#define __COGL_XLIB_H__ + +#include + +#include + +#define __COGL_XLIB_H_INSIDE__ + +#include +#include + +G_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 + */ +#define cogl_xlib_get_display cogl_xlib_get_display_EXP +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 + */ +#define cogl_xlib_set_display cogl_xlib_set_display_EXP +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 + */ +#define cogl_xlib_handle_event cogl_xlib_handle_event_EXP +CoglFilterReturn +cogl_xlib_handle_event (XEvent *xevent); + +#undef __COGL_XLIB_H_INSIDE__ + +#endif /* __COGL_XLIB_H__ */ diff --git a/cogl/cogl.c b/cogl/cogl.c new file mode 100644 index 0000000..95d8d5f --- /dev/null +++ b/cogl/cogl.c @@ -0,0 +1,860 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "cogl-debug.h" +#include "cogl-internal.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" + +#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 */ + +CoglFuncPtr +cogl_get_proc_address (const char* name) +{ + _COGL_GET_CONTEXT (ctx, NULL); + + return _cogl_renderer_get_proc_address (ctx->display->renderer, name); +} + +gboolean +_cogl_check_extension (const char *name, const gchar *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; +} + +/* XXX: This has been deprecated as public API */ +gboolean +cogl_check_extension (const char *name, const char *ext) +{ + return _cogl_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 (gboolean 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 */ +gboolean +cogl_get_depth_test_enabled (void) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + return ctx->legacy_depth_test_enabled; +} + +void +cogl_set_backface_culling_enabled (gboolean 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--; +} + +gboolean +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; +} + +gboolean +cogl_features_available (CoglFeatureFlags features) +{ + _COGL_GET_CONTEXT (ctx, 0); + + return (ctx->feature_flags & features) == features; +} + +gboolean +cogl_has_feature (CoglContext *ctx, CoglFeatureID feature) +{ + return COGL_FLAGS_GET (ctx->features, feature); +} + +gboolean +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, + guint8 *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 gboolean 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 (pipeline, + FALSE, + cogl_pipeline_get_n_layers (pipeline)); + + /* Disable any cached vertex arrays */ + _cogl_attribute_disable_cached_arrays (); +} + +void +cogl_end_gl (void) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!ctx->in_begin_gl_block) + { + static gboolean 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); +} + +GQuark +_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 */ + gboolean enable_legacy; +} CoglSourceState; + +static void +_push_source_real (CoglPipeline *pipeline, gboolean 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, gboolean 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; +} + +gboolean +_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 (guint8 red, + guint8 green, + guint8 blue, + guint8 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 + +GQuark +_cogl_error_quark (void) +{ + return g_quark_from_static_string ("cogl-error-quark"); +} + +void +_cogl_init (void) +{ + static gsize init_status = 0; + + if (g_once_init_enter (&init_status)) + { + bindtextdomain (GETTEXT_PACKAGE, COGL_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + + g_type_init (); + + _cogl_config_read (); + _cogl_debug_check_environment (); + g_once_init_leave (&init_status, 1); + } +} + +/* + * 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() */ +gboolean +_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..b27b759 --- /dev/null +++ b/cogl/cogl.h @@ -0,0 +1,142 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_H__ +#define __COGL_H__ + +#include + +#define __COGL_H_INSIDE__ + +#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 + +/* + * 1.x only api... + */ +#ifndef COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +#include +#include +#include +#include +#include +#include +#endif + +/* + * 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 +#if defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT) +#include +#endif +#if 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 + +/* + * 2.0 only api... + */ +#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +/* This header will be removed in Cogl 1.12 */ +#include +#endif + +/* + * API deprecations + */ +#include + +/** + * SECTION:cogl + * @short_description: General purpose API + * + * General utility functions for COGL. + */ + +#undef __COGL_H_INSIDE__ + +#endif /* __COGL_H__ */ diff --git a/cogl/cogl.rc b/cogl/cogl.rc new file mode 100644 index 0000000..06da0f0 --- /dev/null +++ b/cogl/cogl.rc @@ -0,0 +1,30 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,10,2,0 + PRODUCTVERSION 1,10,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.10.2.0" + VALUE "InternalName", "libcogl-1.0-1" + VALUE "LegalCopyright", "Copyright 1995-2011 © Intel Corporation" + VALUE "OriginalFilename", "libcogl-1.0-1.dll" + VALUE "ProductName", "cogl" + VALUE "ProductVersion", "1.10.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..e23b3ed --- /dev/null +++ b/cogl/cogl.symbols @@ -0,0 +1,895 @@ +#if 0 +/* note: those with the _EXP suffix are defined as */ +/* the same symbols sans the _EXP suffix */ +/* (this may be subject to change!) */ +#endif + +/* cogl2_clip_push_from_path is only for 1.10.x*/ +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 + +#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT +cogl_android_set_native_window_EXP +#endif + +cogl_angle_cos +cogl_angle_sin +cogl_angle_tan + +cogl_attribute_new +cogl_attribute_buffer_new +cogl_attribute_get_buffer +cogl_attribute_get_normalized +cogl_attribute_set_buffer +cogl_attribute_set_normalized +cogl_attribute_type_get_type + +cogl_begin_gl + +cogl_bitmap_error_get_type +cogl_bitmap_error_quark +cogl_bitmap_get_buffer +cogl_bitmap_get_format +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_blend_string_error_quark + +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_set_data +cogl_buffer_set_update_hint +#if 0 +/* not implemented! */ +cogl_buffer_set_usage_hint_EXP +#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_from_path +cogl_clip_push_from_path_preserve +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 +cogl_color_get_red +cogl_color_get_red_byte +cogl_color_get_red_float +cogl_color_init_from_4f +cogl_color_init_from_4fv +cogl_color_init_from_4ub +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_unpremultiply + + +#ifdef COGL_HAS_EGL_SUPPORT +cogl_egl_context_get_egl_display +#endif + +cogl_context_get_display +cogl_context_new + +cogl_create_program +cogl_create_shader + +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 + +cogl_display_get_renderer +cogl_display_new +cogl_display_setup + +cogl_double_to_fixed +cogl_double_to_int +cogl_double_to_uint + +cogl_end_gl + +cogl_error_get_type + +cogl_euler_copy +cogl_euler_equal +cogl_euler_free +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_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_allocate +cogl_framebuffer_clear4f +cogl_framebuffer_clear +cogl_framebuffer_discard_buffers +cogl_framebuffer_draw_attributes +cogl_framebuffer_draw_indexed_attributes +cogl_framebuffer_draw_primitive +cogl_framebuffer_draw_rectangle +cogl_framebuffer_draw_rectangles +cogl_framebuffer_draw_textured_rectangle +cogl_framebuffer_draw_textured_rectangles +cogl_framebuffer_error_quark +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_dither_enabled +cogl_framebuffer_get_green_bits +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_path_clip +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 +cogl_framebuffer_scale +cogl_framebuffer_set_color_mask +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_EGL_PLATFORM_GDL_SUPPORT +cogl_gdl_display_set_plane +#endif + +cogl_frustum + +cogl_get_backface_culling_enabled +cogl_get_bitmasks +cogl_get_depth_test_enabled +cogl_get_draw_framebuffer +cogl_get_features +cogl_get_modelview_matrix +cogl_get_option_group +cogl_get_path /* this is COGL 1.0 API */ +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_GLIB_SUPPORT +cogl_glib_source_new +#endif + +#ifdef _COGL_SUPPORTS_GTYPE_INTEGRATION +/* cogl_gtype_matrix_get_type */ /* Not Implemented */ +#endif + +cogl_handle_get_type +cogl_handle_ref +cogl_handle_unref + +cogl_has_feature +cogl_has_features + +cogl_index_buffer_new +cogl_indices_get_buffer +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_attribute +cogl_is_attribute_buffer +cogl_is_bitmap +cogl_is_buffer +cogl_is_context +cogl_is_index_buffer +#if 0 +/* not implemented! */ +cogl_is_indices_array +#endif +cogl_is_material +cogl_is_offscreen +cogl_is_path +cogl_is_pipeline +cogl_is_pixel_buffer_EXP +cogl_is_primitive +cogl_is_program +cogl_is_renderer +cogl_is_shader +cogl_is_snippet +cogl_is_sub_texture_EXP +cogl_is_texture +#ifdef COGL_HAS_X11 +cogl_is_texture_pixmap_x11 +#endif +cogl_is_texture_rectangle_EXP +cogl_is_texture_2d_EXP +cogl_is_texture_3d +cogl_is_vertex_buffer +cogl_is_vertex_buffer_indices + +#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT +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_equal +cogl_matrix_free +cogl_matrix_frustum +cogl_matrix_get_array +cogl_matrix_get_inverse +cogl_matrix_init_from_array +cogl_matrix_is_identity +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 +cogl_matrix_scale +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 + +cogl_object_get_user_data +cogl_object_ref +cogl_object_set_user_data +cogl_object_unref + +cogl_offscreen_new_to_texture + +#ifndef COGL_DISABLE_DEPRECATED +cogl_offscreen_ref +cogl_offscreen_unref +#endif + +cogl_onscreen_add_swap_buffers_callback +#ifndef COGL_WINSYS_INTEGRATED +cogl_onscreen_clutter_backend_set_size_CLUTTER +#endif +cogl_onscreen_hide +cogl_onscreen_new +cogl_onscreen_set_swap_throttled +cogl_onscreen_remove_swap_buffers_callback +cogl_onscreen_show +cogl_onscreen_swap_buffers +cogl_onscreen_swap_region +cogl_onscreen_template_new_EXP +cogl_onscreen_template_set_samples_per_pixel +cogl_onscreen_template_set_swap_throttled + +cogl_ortho + +cogl_path_arc +cogl_path_close +cogl_path_copy +cogl_path_curve_to +cogl_path_ellipse +cogl_path_fill +cogl_path_fill_preserve /* this is COGL 1.0 API */ +cogl_path_fill_rule_get_type +cogl_path_get_fill_rule +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 /* this is COGL 1.0 API */ + +cogl_perspective + +cogl_pipeline_add_layer_snippet +cogl_pipeline_add_snippet +cogl_pipeline_cache_free +cogl_pipeline_cache_new +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 +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_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_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 + +cogl_pixel_buffer_new_EXP +#if 0 +/* not exported in the main APIs for now */ +cogl_pixel_buffer_set_region_EXP +#endif +cogl_pixel_format_get_type + +cogl_poll_dispatch +cogl_poll_get_info + +cogl_polygon + +#ifndef COGL_DISABLE_DEPRECATED +cogl_pop_draw_buffer +#endif +cogl_pop_framebuffer +cogl_pop_matrix +cogl_pop_source + +cogl_primitive_copy +cogl_primitive_foreach_attribute +cogl_primitive_get_first_vertex +cogl_primitive_get_indices +cogl_primitive_get_mode +cogl_primitive_get_n_vertices_EXP +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_EXP +cogl_primitive_set_mode +cogl_primitive_set_n_vertices_EXP + +cogl_program_attach_shader +cogl_program_get_uniform_location +cogl_program_link +cogl_program_ref +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 +#endif +cogl_program_unref +cogl_program_use + +#ifndef COGL_DISABLE_DEPRECATED +cogl_push_draw_buffer +#endif + +cogl_push_framebuffer +cogl_push_matrix +cogl_push_source + +cogl_quaternion_copy +cogl_quaternion_dot_product +cogl_quaternion_equal +cogl_quaternion_free +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_get_driver +cogl_renderer_get_n_fragment_texture_units +cogl_renderer_error_get_type +cogl_renderer_error_quark +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 +cogl_set_framebuffer +cogl_set_modelview_matrix +cogl_set_path /* this is COGL 1.0 API */ +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 +#ifndef COGL_DISABLE_DEPRECATED +cogl_shader_unref +#endif +cogl_shader_type_get_type + +cogl_snippet_get_declarations +cogl_snippet_get_hook +cogl_snippet_get_post +cogl_snippet_get_pre +cogl_snippet_get_replace +cogl_snippet_new +cogl_snippet_set_declarations +cogl_snippet_set_post +cogl_snippet_set_pre +cogl_snippet_set_replace + +cogl_sqrti + +cogl_sub_texture_get_parent +cogl_sub_texture_new_EXP + +cogl_swap_chain_new_EXP +cogl_swap_chain_set_has_alpha_EXP +cogl_swap_chain_set_length_EXP + +cogl_texture_error_quark +cogl_texture_flags_get_type +cogl_texture_get_data +cogl_texture_get_format +cogl_texture_get_gl_texture +cogl_texture_get_height +cogl_texture_get_max_waste +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_quark +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 +cogl_texture_rectangle_new_with_size_EXP +#ifndef COGL_DISABLE_DEPRECATED +cogl_texture_ref +#endif +cogl_texture_set_region +cogl_texture_set_region_from_bitmap_EXP +#ifndef COGL_DISABLE_DEPRECATED +cogl_texture_unref +#endif +cogl_texture_2d_new_from_data_EXP +cogl_texture_2d_new_from_foreign_EXP +cogl_texture_2d_new_with_size_EXP +cogl_texture_2d_sliced_new_with_size +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_onscreen_resize +cogl_wayland_renderer_get_compositor +cogl_wayland_renderer_get_display +cogl_wayland_renderer_get_shell +cogl_wayland_renderer_set_foreign_compositor +cogl_wayland_renderer_set_foreign_display +cogl_wayland_renderer_set_foreign_shell +cogl_wayland_texture_2d_new_from_buffer_EXP +#endif + +#ifdef COGL_HAS_WIN32_SUPPORT +cogl_win32_onscreen_get_window +cogl_win32_onscreen_set_foreign_window +cogl_win32_renderer_add_filter_EXP +cogl_win32_renderer_handle_event_EXP +cogl_win32_renderer_remove_filter_EXP +#endif + +#ifdef COGL_HAS_XLIB +cogl_xlib_get_display_EXP +cogl_xlib_handle_event_EXP +cogl_xlib_renderer_add_filter_EXP +cogl_xlib_renderer_get_display_EXP +cogl_xlib_renderer_get_foreign_display_EXP +cogl_xlib_renderer_handle_event_EXP +cogl_xlib_renderer_remove_filter_EXP +cogl_xlib_renderer_set_event_retrieval_enabled +cogl_xlib_renderer_set_foreign_display_EXP +cogl_xlib_set_display_EXP +#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_copy_rectangle +_cogl_atlas_new +_cogl_atlas_remove +_cogl_atlas_remove_reorganize_callback +_cogl_atlas_reserve_space +_cogl_atlas_texture_add_reorganize_callback +_cogl_atlas_texture_new_from_bitmap +_cogl_atlas_texture_new_with_size +_cogl_atlas_texture_remove_reorganize_callback +_cogl_context_get_default +_cogl_error_quark +_cogl_texture_associate_framebuffer +_cogl_texture_can_hardware_repeat +_cogl_texture_determine_internal_format +_cogl_texture_draw_and_read +_cogl_texture_ensure_non_quad_rendering +_cogl_texture_flush_journal_rendering +_cogl_texture_free +_cogl_texture_get_associated_framebuffers +_cogl_texture_get_gl_format +_cogl_texture_init +_cogl_texture_is_foreign +_cogl_texture_prepare_for_upload +_cogl_texture_prep_gl_alignment_for_pixels_upload +_cogl_texture_pre_paint +_cogl_texture_register_texture_type +_cogl_texture_set_filters +_cogl_texture_set_wrap_mode_parameters +_cogl_texture_transform_coords_to_gl +_cogl_texture_transform_quad_coords_to_gl +#endif \ No newline at end of file diff --git a/cogl/cogl1-context.h b/cogl/cogl1-context.h new file mode 100644 index 0000000..c59bd69 --- /dev/null +++ b/cogl/cogl1-context.h @@ -0,0 +1,1167 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * Authors: + * Robert Bragg + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL_1_CONTEXT_H__ +#define __COGL_1_CONTEXT_H__ + +#include + +#include +#include +#include + +G_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 + */ +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 + */ +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. + */ +gboolean +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. + * + * Return value: a pointer to the requested function or %NULL if the + * function is not available. + */ +CoglFuncPtr +cogl_get_proc_address (const char *name); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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: + * |[ + * gboolean retval = (strstr (ext, name) != NULL) ? TRUE : FALSE; + * ]| + */ +gboolean +cogl_check_extension (const char *name, + const char *ext) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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. + */ +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. + */ +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 + */ +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 + */ +void +cogl_ortho (float left, + float right, + float bottom, + float top, + float near, + float far); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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.2: Use cogl_set_viewport() instead + */ +void +cogl_viewport (unsigned int width, + unsigned int height) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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 + */ +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(). + */ +void +cogl_push_matrix (void); + +/** + * cogl_pop_matrix: + * + * Restores the current model-view matrix from the matrix stack. + */ +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. + */ +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. + */ +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. + */ +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 + */ +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. + */ +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. + */ +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. + */ +void +cogl_get_projection_matrix (CoglMatrix *matrix); + +/** + * cogl_set_projection_matrix: + * @matrix: the new projection matrix + * + * Loads matrix as the new 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. + */ +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.4: Use cogl_material_set_depth_test_enabled() + * instead. + */ +void +cogl_set_depth_test_enabled (gboolean 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.4: Use cogl_material_get_depth_test_enabled() + * instead. + */ +gboolean +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. + */ +void +cogl_set_backface_culling_enabled (gboolean 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 + */ +gboolean +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. + */ +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. + */ +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. + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +void +cogl_set_source_color4ub (guint8 red, + guint8 green, + guint8 blue, + guint8 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 + */ +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 + */ +void +cogl_set_source_texture (CoglTexture *texture); + + +/** + * 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. + */ + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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.2: Use cogl_clip_push_window_rectangle() instead + */ +void +cogl_clip_push_window_rect (float x_offset, + float y_offset, + float width, + float height) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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 + */ +void +cogl_clip_push_window_rectangle (int x_offset, + int y_offset, + int width, + int height); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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.2: 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_clip_push_rectangle() + * instead + */ +void +cogl_clip_push (float x_offset, + float y_offset, + float width, + float height) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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 + */ +void +cogl_clip_push_rectangle (float x0, + float y0, + float x1, + float y1); + +/** + * 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 + */ +void +cogl_clip_push_from_path_preserve (void); + +#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API +/** + * 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 top-left corner of the primitives + * bounds + * @bounds_y2: x coordinate for the bottom-right corner of the + * primitives bounds. + * @bounds_x1: 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 + */ +void +cogl_clip_push_primitive (CoglPrimitive *primitive, + float bounds_x1, + float bounds_y1, + float bounds_x2, + float bounds_y2); +#endif + +/** + * cogl_clip_pop: + * + * Reverts the clipping region to the state before the last call to + * cogl_clip_push(). + */ +void +cogl_clip_pop (void); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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 + */ +void +cogl_clip_ensure (void) G_GNUC_DEPRECATED; + +/** + * 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 + */ +void +cogl_clip_stack_save (void) G_GNUC_DEPRECATED; + +/** + * 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 + */ +void +cogl_clip_stack_restore (void) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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 + */ +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 + */ +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 + */ +void +cogl_pop_framebuffer (void); + +#ifndef COGL_DISABLE_DEPRECATED + +/** + * 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.2: The target argument was redundant since we could look at + * the type of CoglHandle given instead. + */ +void +cogl_set_draw_buffer (CoglBufferTarget target, + CoglHandle offscreen) G_GNUC_DEPRECATED; + +/** + * cogl_push_draw_buffer: + * + * Save cogl_set_draw_buffer() state. + * + * Deprecated: 1.2: The draw buffer API was replaced with a framebuffer API + */ +void +cogl_push_draw_buffer (void) G_GNUC_DEPRECATED; + +/** + * cogl_pop_draw_buffer: + * + * Restore cogl_set_draw_buffer() state. + * + * Deprecated: 1.2: The draw buffer API was replaced with a framebuffer API + */ +void +cogl_pop_draw_buffer (void) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ + +/** + * 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. + */ +void +cogl_read_pixels (int x, + int y, + int width, + int height, + CoglReadPixelsFlags source, + CoglPixelFormat format, + guint8 *pixels); + +/** + * 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 + */ +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 + */ +void +cogl_end_gl (void); + +G_END_DECLS + +#endif /* __COGL_1_CONTEXT_H__ */ diff --git a/cogl/cogl2-compatibility.c b/cogl/cogl2-compatibility.c new file mode 100644 index 0000000..bae88c2 --- /dev/null +++ b/cogl/cogl2-compatibility.c @@ -0,0 +1,148 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see + * . + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* These functions are just here temporarily for the 1.10.x releases + to maintain ABI compatibility. They will be removed again + immediately once the branch for 1.12.x is created */ + +#include "cogl2-compatibility.h" +#include "cogl-framebuffer.h" +#include "cogl-index-buffer.h" +#include "cogl-pipeline.h" + +void +cogl_clip_push_from_path (CoglPath *path) +{ + cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (), path); +} + +/* These were never declared in a public header so we might as well + keep it that way. The declarations here are just to avoid a + warning */ +GQuark +cogl_display_error_quark (void); + +GQuark +cogl_onscreen_template_error_quark (void); + +GQuark +cogl_swap_chain_error_quark (void); + +GQuark +cogl_texture_3d_error_quark (void); + +gboolean +cogl_index_buffer_allocate (CoglIndexBuffer *indices, + GError *error); + +gboolean +cogl_is_journal (void *object); + +void +cogl_vdraw_indexed_attributes (CoglFramebuffer *framebuffer, + CoglPipeline *pipeline, + CoglVerticesMode mode, + int first_vertex, + int n_vertices, + CoglIndices *indices, + ...); + +GQuark +cogl_display_error_quark (void) +{ + return g_quark_from_static_string ("cogl-display-error-quark"); +} + +GQuark +cogl_onscreen_template_error_quark (void) +{ + return g_quark_from_static_string ("cogl-onscreen-template-error-quark"); +} + +GQuark +cogl_swap_chain_error_quark (void) +{ + return g_quark_from_static_string ("cogl-swap-chain-error-quark"); +} + +GQuark +cogl_texture_3d_error_quark (void) +{ + return g_quark_from_static_string ("cogl-texture-3d-error-quark"); +} + +gboolean +cogl_index_buffer_allocate (CoglIndexBuffer *indices, + GError *error) +{ + return TRUE; +} + +gboolean +cogl_is_journal (void *object) +{ + /* There's no way to get a pointer to a journal so this will never + return TRUE from an application's perspective */ + return FALSE; +} + +void +cogl_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); +} diff --git a/cogl/cogl2-compatibility.h b/cogl/cogl2-compatibility.h new file mode 100644 index 0000000..3c9f979 --- /dev/null +++ b/cogl/cogl2-compatibility.h @@ -0,0 +1,55 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL2_COMPATIBILITY_H__ +#define __COGL2_COMPATIBILITY_H__ + +#include +#include + +G_BEGIN_DECLS + +#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 + */ +void +cogl_clip_push_from_path (CoglPath *path); + +G_END_DECLS + +#endif /* __COGL2_COMPATIBILITY_H__ */ + diff --git a/cogl/cogl2-experimental.h b/cogl/cogl2-experimental.h new file mode 100644 index 0000000..604ba3f --- /dev/null +++ b/cogl/cogl2-experimental.h @@ -0,0 +1,31 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL2_EXPERIMENTAL_H__ +#define __COGL2_EXPERIMENTAL_H__ + +#define COGL_ENABLE_EXPERIMENTAL_2_0_API +#include + +#endif /* __COGL2_EXPERIMENTAL_H__ */ diff --git a/cogl/cogl2-path.c b/cogl/cogl2-path.c new file mode 100644 index 0000000..d9426ae --- /dev/null +++ b/cogl/cogl2-path.c @@ -0,0 +1,1449 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * Authors: + * Ivan Leben + * Øyvind Kolås + * Neil Roberts + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-util.h" +#include "cogl-object.h" +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-journal-private.h" +#include "cogl-pipeline-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-framebuffer-private.h" +#include "cogl-path-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 +#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 void _cogl_path_build_stroke_attribute_buffer (CoglPath *path); + +COGL_OBJECT_DEFINE (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->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->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, + gboolean 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) +{ + CoglPathData *data = path->data; + CoglPipeline *copy = NULL; + CoglPipeline *source; + unsigned int path_start; + int path_num = 0; + CoglPathNode *node; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + source = cogl_get_source (); + + if (cogl_pipeline_get_n_layers (source) != 0) + { + copy = cogl_pipeline_copy (source); + _cogl_pipeline_prune_to_n_layers (copy, 0); + source = copy; + } + + _cogl_path_build_stroke_attribute_buffer (path); + + cogl_push_source (source); + + 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); + + cogl_framebuffer_vdraw_attributes (cogl_get_draw_framebuffer (), + source, + COGL_VERTICES_MODE_LINE_STRIP, + 0, node->path_size, + data->stroke_attributes[path_num], + NULL); + + path_num++; + } + + cogl_pop_source (); + + 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 *fb; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_STENCIL_BUFFER)) + { + static gboolean 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; + } + } + + fb = cogl_get_draw_framebuffer (); + cogl_framebuffer_push_path_clip (fb, path); + cogl_rectangle (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 (fb); +} + +static gboolean +validate_layer_cb (CoglPipelineLayer *layer, void *user_data) +{ + gboolean *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; +} + +void +_cogl_path_fill_nodes (CoglPath *path, CoglDrawFlags flags) +{ + gboolean needs_fallback = FALSE; + CoglPipeline *pipeline = cogl_get_source (); + + _cogl_pipeline_foreach_layer_internal (pipeline, + validate_layer_cb, &needs_fallback); + if (needs_fallback) + { + _cogl_path_fill_nodes_with_clipped_rectangle (path); + return; + } + + _cogl_path_build_fill_attribute_buffer (path); + + _cogl_framebuffer_draw_indexed_attributes (cogl_get_draw_framebuffer (), + pipeline, + COGL_VERTICES_MODE_TRIANGLES, + 0, /* first_vertex */ + path->data->fill_vbo_n_indices, + path->data->fill_vbo_indices, + path->data->fill_attributes, + COGL_PATH_N_ATTRIBUTES, + flags); +} + +void +cogl2_path_fill (CoglPath *path) +{ + _COGL_RETURN_IF_FAIL (cogl_is_path (path)); + + if (path->data->path_nodes->len == 0) + return; + + /* If the path is a simple rectangle then we can divert to using + cogl_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) + { + float x_1, y_1, x_2, y_2; + + _cogl_path_get_bounds (path, &x_1, &y_1, &x_2, &y_2); + cogl_rectangle (x_1, y_1, x_2, y_2); + } + else + _cogl_path_fill_nodes (path, 0); +} + +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); +} + +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) +{ + gboolean 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; +} + +gboolean +_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; + + path = g_slice_new (CoglPath); + data = path->data = g_slice_new (CoglPathData); + + data->ref_count = 1; + 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->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 guint8, guint16 or guint32 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 (guint8)); + break; + + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + tess->indices = g_array_new (FALSE, FALSE, sizeof (guint16)); + break; + + case COGL_INDICES_TYPE_UNSIGNED_INT: + tess->indices = g_array_new (FALSE, FALSE, sizeof (guint32)); + break; + } +} + +static void +_cogl_path_tesselator_add_index (CoglPathTesselator *tess, int vertex_index) +{ + switch (tess->indices_type) + { + case COGL_INDICES_TYPE_UNSIGNED_BYTE: + { + guint8 val = vertex_index; + g_array_append_val (tess->indices, val); + } + break; + + case COGL_INDICES_TYPE_UNSIGNED_SHORT: + { + guint16 val = vertex_index; + g_array_append_val (tess->indices, val); + } + break; + + case COGL_INDICES_TYPE_UNSIGNED_INT: + { + guint32 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, + guint8, 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, + guint16, 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, + guint32, 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; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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 (ctx, + 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 (ctx, + tess.indices_type, + tess.indices->data, + tess.indices->len); + data->fill_vbo_n_indices = tess.indices->len; + g_array_free (tess.indices, TRUE); +} + +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; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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 (ctx, data->path_nodes->len * sizeof (floatVec2), + NULL); + + 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; +} diff --git a/cogl/cogl2-path.h b/cogl/cogl2-path.h new file mode 100644 index 0000000..f702c4a --- /dev/null +++ b/cogl/cogl2-path.h @@ -0,0 +1,506 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __COGL2_PATH_H__ +#define __COGL2_PATH_H__ + +#include + +G_BEGIN_DECLS + +/** + * 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. + */ + +typedef struct _CoglPath CoglPath; + +#define COGL_PATH(obj) ((CoglPath *)(obj)) + +#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: 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 + */ +gboolean +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); + +/** + * 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 is %COGL_PATH_FILL_RULE_EVEN_ODD. The fill + * rule is attached to the current path so preserving a path with + * cogl_get_path() also preserves the fill rule. Calling + * cogl_path_new() resets the current fill rule to the default. + * + *
+ * 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; + +#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); + +#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); + +G_END_DECLS + +#endif /* __COGL2_PATH_H__ */ + diff --git a/cogl/driver/gl/cogl-gl.c b/cogl/driver/gl/cogl-gl.c new file mode 100644 index 0000000..b35ddbe --- /dev/null +++ b/cogl/driver/gl/cogl-gl.c @@ -0,0 +1,277 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-private.h" +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-feature-private.h" +#include "cogl-renderer-private.h" + +static gboolean +_cogl_get_gl_version (int *major_out, int *minor_out) +{ + const char *version_string, *major_end, *minor_end; + int major = 0, minor = 0; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* Get the OpenGL version number */ + if ((version_string = (const char *) ctx->glGetString (GL_VERSION)) == NULL) + return FALSE; + + /* 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; +} + +static gboolean +check_gl_version (CoglContext *ctx, + GError **error) +{ + int major, minor; + const char *gl_extensions; + + if (!_cogl_get_gl_version (&major, &minor)) + { + g_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; + + gl_extensions = (const char*) ctx->glGetString (GL_EXTENSIONS); + + /* OpenGL 1.2 is only supported if we have the multitexturing + extension */ + if (!_cogl_check_extension ("GL_ARB_multitexture", gl_extensions)) + { + g_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)) + { + g_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; +} + +gboolean +_cogl_gl_update_features (CoglContext *context, + GError **error) +{ + CoglPrivateFeatureFlags private_flags = 0; + CoglFeatureFlags flags = 0; + const char *gl_extensions; + int max_clip_planes = 0; + int num_stencil_bits = 0; + int gl_major = 0, gl_minor = 0; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* 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"); + + if (!check_gl_version (context, error)) + return FALSE; + + 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), + ctx->glGetString (GL_VERSION), + ctx->glGetString (GL_EXTENSIONS)); + + _cogl_get_gl_version (&gl_major, &gl_minor); + + 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); + + gl_extensions = (const char *)ctx->glGetString (GL_EXTENSIONS); + + _cogl_feature_check_ext_functions (context, + 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)) + private_flags |= COGL_PRIVATE_FEATURE_MESA_PACK_INVERT; + + GE( ctx, glGetIntegerv (GL_STENCIL_BITS, &num_stencil_bits) ); + /* We need at least three stencil bits to combine clips */ + if (num_stencil_bits > 2) + private_flags |= COGL_PRIVATE_FEATURE_STENCIL_BUFFER; + + GE( ctx, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) ); + if (max_clip_planes >= 4) + private_flags |= COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES; + + if (context->glGenRenderbuffers) + { + flags |= COGL_FEATURE_OFFSCREEN; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_OFFSCREEN, TRUE); + } + + if (context->glBlitFramebuffer) + private_flags |= COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT; + + if (context->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, 2, 1) || + _cogl_check_extension ("GL_EXT_pixel_buffer_object", gl_extensions)) + private_flags |= COGL_PRIVATE_FEATURE_PBOS; + + if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) || + _cogl_check_extension ("GL_ARB_point_sprite", gl_extensions)) + { + flags |= COGL_FEATURE_POINT_SPRITE; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_POINT_SPRITE, TRUE); + } + + if (context->glGenPrograms) + { + flags |= COGL_FEATURE_SHADERS_ARBFP; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_ARBFP, TRUE); + } + + if (context->glCreateProgram) + { + flags |= COGL_FEATURE_SHADERS_GLSL; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE); + } + + if (context->glGenBuffers) + { + private_flags |= COGL_PRIVATE_FEATURE_VBOS; + 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 (context->glTexImage3D) + { + flags |= COGL_FEATURE_TEXTURE_3D; + COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_3D, TRUE); + } + + if (context->glEGLImageTargetTexture2D) + private_flags |= COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE; + + if (_cogl_check_extension ("GL_EXT_packed_depth_stencil", gl_extensions)) + private_flags |= COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL; + + /* Cache features */ + context->private_feature_flags |= private_flags; + context->feature_flags |= flags; + + return TRUE; +} diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c new file mode 100644 index 0000000..83d47ae --- /dev/null +++ b/cogl/driver/gl/cogl-texture-driver-gl.c @@ -0,0 +1,594 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + * + * 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-handle.h" +#include "cogl-primitives.h" +#include "cogl-pipeline-opengl-private.h" + +#include +#include +#include + +static void +_cogl_texture_driver_gen (GLenum gl_target, + GLsizei n, + GLuint *textures) +{ + unsigned int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + GE (ctx, glGenTextures (n, textures)); + + for (i = 0; i < n; i++) + { + _cogl_bind_gl_texture_transient (gl_target, + textures[i], + 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; + + case GL_TEXTURE_RECTANGLE_ARB: + /* Texture rectangles already default to GL_LINEAR so nothing + needs to be done */ + break; + + default: + g_assert_not_reached(); + } + } +} + +/* OpenGL - unlike GLES - can upload a sub region of pixel data from a larger + * source buffer */ +static void +prep_gl_for_pixels_upload_full (int pixels_rowstride, + int image_height, + int pixels_src_x, + int pixels_src_y, + int pixels_bpp) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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_prep_gl_alignment_for_pixels_upload (pixels_rowstride); +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_upload (int pixels_rowstride, + int pixels_bpp) +{ + prep_gl_for_pixels_upload_full (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 (int pixels_rowstride, + int image_height, + int pixels_src_x, + int pixels_src_y, + int pixels_bpp) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + 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_prep_gl_alignment_for_pixels_download (pixels_rowstride); +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_download (int pixels_rowstride, + int pixels_bpp) +{ + prep_gl_for_pixels_download_full (pixels_rowstride, 0, 0, 0, pixels_bpp); +} + +static void +_cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + CoglBitmap *source_bmp, + GLuint source_gl_format, + GLuint source_gl_type) +{ + guint8 *data; + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0); + + /* Setup gl alignment to match rowstride and top-left corner */ + prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp), + 0, + src_x, + src_y, + bpp); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + GE( ctx, glTexSubImage2D (gl_target, 0, + dst_x, dst_y, + width, height, + source_gl_format, + source_gl_type, + data) ); + + _cogl_bitmap_unbind (source_bmp); +} + +static void +_cogl_texture_driver_upload_to_gl (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type) +{ + guint8 *data; + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0); + + /* Setup gl alignment to match rowstride and top-left corner */ + prep_gl_for_pixels_upload_full (cogl_bitmap_get_rowstride (source_bmp), + 0, 0, 0, bpp); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + GE( 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) ); + + _cogl_bitmap_unbind (source_bmp); +} + +static void +_cogl_texture_driver_upload_to_gl_3d (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + GLint height, + GLint depth, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type) +{ + guint8 *data; + CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); + int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0); + + /* Setup gl alignment to match rowstride and top-left corner */ + prep_gl_for_pixels_upload_full (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); + + GE( 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) ); + + _cogl_bitmap_unbind (source_bmp); +} + +static gboolean +_cogl_texture_driver_gl_get_tex_image (GLenum gl_target, + GLenum dest_gl_format, + GLenum dest_gl_type, + guint8 *dest) +{ + _COGL_GET_CONTEXT (ctx, FALSE); + + GE (ctx, glGetTexImage (gl_target, + 0, /* level */ + dest_gl_format, + dest_gl_type, + (GLvoid *)dest)); + return TRUE; +} + +static gboolean +_cogl_texture_driver_size_supported_3d (GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height, + int depth) +{ + GLenum proxy_target; + GLint new_width = 0; + + _COGL_GET_CONTEXT (ctx, FALSE); + + 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 gboolean +_cogl_texture_driver_size_supported (GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height) +{ + GLenum proxy_target; + GLint new_width = 0; + + _COGL_GET_CONTEXT (ctx, FALSE); + + 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_RGBA, + 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 ( + GLuint gl_target, + const GLfloat *transparent_color) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* 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 gboolean +_cogl_texture_driver_pixel_format_from_gl_internal (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: + + *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_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_texture_driver_pixel_format_to_gl (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_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_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 gboolean +_cogl_texture_driver_allows_foreign_gl_target (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 void +_cogl_texture_driver_gl_generate_mipmaps (GLenum gl_target) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + GE( ctx, glGenerateMipmap (gl_target) ); +} + +static CoglPixelFormat +_cogl_texture_driver_find_best_gl_get_data_format ( + CoglPixelFormat format, + GLenum *closest_gl_format, + GLenum *closest_gl_type) +{ + /* Find closest format that's supported by GL */ + return _cogl_texture_driver_pixel_format_to_gl (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_pixel_format_from_gl_internal, + _cogl_texture_driver_pixel_format_to_gl, + _cogl_texture_driver_allows_foreign_gl_target, + _cogl_texture_driver_gl_generate_mipmaps, + _cogl_texture_driver_find_best_gl_get_data_format + }; diff --git a/cogl/driver/gles/cogl-gles.c b/cogl/driver/gles/cogl-gles.c new file mode 100644 index 0000000..8087ae0 --- /dev/null +++ b/cogl/driver/gles/cogl-gles.c @@ -0,0 +1,174 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl-internal.h" +#include "cogl-context-private.h" +#include "cogl-feature-private.h" +#include "cogl-renderer-private.h" +#include "cogl-private.h" + +gboolean +_cogl_gles_update_features (CoglContext *context, + GError **error) +{ + CoglPrivateFeatureFlags private_flags = 0; + CoglFeatureFlags flags = 0; + const char *gl_extensions; + int num_stencil_bits = 0; + + /* 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"); + + 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), + context->glGetString (GL_VERSION), + context->glGetString (GL_EXTENSIONS)); + + gl_extensions = (const char*) context->glGetString (GL_EXTENSIONS); + + _cogl_feature_check_ext_functions (context, + -1 /* GL major version */, + -1 /* GL minor version */, + gl_extensions); + + GE( context, glGetIntegerv (GL_STENCIL_BITS, &num_stencil_bits) ); + /* We need at least three stencil bits to combine clips */ + if (num_stencil_bits > 2) + private_flags |= COGL_PRIVATE_FEATURE_STENCIL_BUFFER; + +#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) + private_flags |= COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES; + } +#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); + } + + private_flags |= COGL_PRIVATE_FEATURE_VBOS; + + /* 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) + private_flags |= COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT; + + 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_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) + private_flags |= COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE; + + if (_cogl_check_extension ("GL_OES_packed_depth_stencil", gl_extensions)) + private_flags |= COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL; + + /* Cache features */ + context->private_feature_flags |= private_flags; + context->feature_flags |= flags; + + return TRUE; +} diff --git a/cogl/driver/gles/cogl-texture-driver-gles.c b/cogl/driver/gles/cogl-texture-driver-gles.c new file mode 100644 index 0000000..2bc596b --- /dev/null +++ b/cogl/driver/gles/cogl-texture-driver-gles.c @@ -0,0 +1,550 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + * + * 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-handle.h" +#include "cogl-primitives.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 + +static void +_cogl_texture_driver_gen (GLenum gl_target, + GLsizei n, + GLuint *textures) +{ + unsigned int i; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + GE (ctx, glGenTextures (n, textures)); + + for (i = 0; i < n; i++) + { + _cogl_bind_gl_texture_transient (gl_target, textures[i], 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(); + } + } +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_upload (int pixels_rowstride, + int pixels_bpp) +{ + _cogl_texture_prep_gl_alignment_for_pixels_upload (pixels_rowstride); +} + +static void +_cogl_texture_driver_prep_gl_for_pixels_download (int pixels_rowstride, + int pixels_bpp) +{ + _cogl_texture_prep_gl_alignment_for_pixels_download (pixels_rowstride); +} + +static CoglBitmap * +prepare_bitmap_alignment_for_upload (CoglBitmap *src_bmp) +{ + 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 (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); +} + +static void +_cogl_texture_driver_upload_subregion_to_gl (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height, + CoglBitmap *source_bmp, + GLuint source_gl_format, + GLuint source_gl_type) +{ + guint8 *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; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + /* If we are copying a sub region of the source bitmap then we need + to copy it because GLES does not support GL_UNPACK_ROW_LENGTH */ + if (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); + _cogl_bitmap_copy_subregion (source_bmp, + slice_bmp, + src_x, src_y, + 0, 0, /* dst_x/y */ + width, height); + } + else + slice_bmp = prepare_bitmap_alignment_for_upload (source_bmp); + + rowstride = cogl_bitmap_get_rowstride (slice_bmp); + + /* Setup gl alignment to match rowstride and top-left corner */ + _cogl_texture_driver_prep_gl_for_pixels_upload (rowstride, bpp); + + data = _cogl_bitmap_bind (slice_bmp, COGL_BUFFER_ACCESS_READ, 0); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + GE( ctx, glTexSubImage2D (gl_target, 0, + dst_x, dst_y, + width, height, + source_gl_format, + source_gl_type, + data) ); + + _cogl_bitmap_unbind (slice_bmp); + + cogl_object_unref (slice_bmp); +} + +static void +_cogl_texture_driver_upload_to_gl (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type) +{ + 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; + guint8 *data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + bmp = prepare_bitmap_alignment_for_upload (source_bmp); + rowstride = cogl_bitmap_get_rowstride (bmp); + + /* Setup gl alignment to match rowstride and top-left corner */ + _cogl_texture_driver_prep_gl_for_pixels_upload (rowstride, bpp); + + _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); + + data = _cogl_bitmap_bind (bmp, COGL_BUFFER_ACCESS_READ, 0); + + GE( ctx, glTexImage2D (gl_target, 0, + internal_gl_format, + bmp_width, bmp_height, + 0, + source_gl_format, + source_gl_type, + data) ); + + _cogl_bitmap_unbind (bmp); + + cogl_object_unref (bmp); +} + +static void +_cogl_texture_driver_upload_to_gl_3d (GLenum gl_target, + GLuint gl_handle, + gboolean is_foreign, + GLint height, + GLint depth, + CoglBitmap *source_bmp, + GLint internal_gl_format, + GLuint source_gl_format, + GLuint source_gl_type) +{ + 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); + guint8 *data; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + _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 (bmp_width * bpp, bpp); + + /* Initialize the texture with empty data and then upload each + image with a sub-region update */ + + GE( ctx, glTexImage3D (gl_target, + 0, /* level */ + internal_gl_format, + bmp_width, + height, + depth, + 0, + source_gl_format, + source_gl_type, + NULL) ); + + bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, + bmp_width, + height, + source_bmp_format); + + for (i = 0; i < depth; i++) + { + _cogl_bitmap_copy_subregion (source_bmp, + bmp, + 0, image_height * i, + 0, 0, + bmp_width, + height); + + data = _cogl_bitmap_bind (bmp, + COGL_BUFFER_ACCESS_READ, 0); + + GE( 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) ); + + _cogl_bitmap_unbind (bmp); + } + + cogl_object_unref (bmp); + } + else + { + data = _cogl_bitmap_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0); + + _cogl_texture_driver_prep_gl_for_pixels_upload (rowstride, bpp); + + GE( ctx, glTexImage3D (gl_target, + 0, /* level */ + internal_gl_format, + bmp_width, + height, + depth, + 0, + source_gl_format, + source_gl_type, + data) ); + + _cogl_bitmap_unbind (source_bmp); + } +} + +/* 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 gboolean +_cogl_texture_driver_gl_get_tex_image (GLenum gl_target, + GLenum dest_gl_format, + GLenum dest_gl_type, + guint8 *dest) +{ + return FALSE; +} + +static gboolean +_cogl_texture_driver_size_supported_3d (GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height, + int depth) +{ + GLint max_size; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* 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 gboolean +_cogl_texture_driver_size_supported (GLenum gl_target, + GLenum gl_format, + GLenum gl_type, + int width, + int height) +{ + GLint max_size; + + _COGL_GET_CONTEXT (ctx, FALSE); + + /* 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 ( + GLuint gl_target, + const GLfloat *transparent_color) +{ + /* FAIL! */ +} + +static gboolean +_cogl_texture_driver_pixel_format_from_gl_internal (GLenum gl_int_format, + CoglPixelFormat *out_format) +{ + return TRUE; +} + +static CoglPixelFormat +_cogl_texture_driver_pixel_format_to_gl (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; + + /* 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_BGRA_8888: + case COGL_PIXEL_FORMAT_BGRA_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_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 gboolean +_cogl_texture_driver_allows_foreign_gl_target (GLenum gl_target) +{ + /* Allow 2-dimensional textures only */ + if (gl_target != GL_TEXTURE_2D) + return FALSE; + return TRUE; +} + +static void +_cogl_texture_driver_gl_generate_mipmaps (GLenum gl_target) +{ + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + if (ctx->driver == COGL_DRIVER_GLES2) + GE( ctx, glGenerateMipmap (gl_target) ); +} + +static CoglPixelFormat +_cogl_texture_driver_find_best_gl_get_data_format ( + 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_pixel_format_from_gl_internal, + _cogl_texture_driver_pixel_format_to_gl, + _cogl_texture_driver_allows_foreign_gl_target, + _cogl_texture_driver_gl_generate_mipmaps, + _cogl_texture_driver_find_best_gl_get_data_format + }; diff --git a/cogl/gl-prototypes/cogl-all-functions.h b/cogl/gl-prototypes/cogl-all-functions.h new file mode 100644 index 0000000..d58b41f --- /dev/null +++ b/cogl/gl-prototypes/cogl-all-functions.h @@ -0,0 +1,212 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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, 255, 255, + 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 () diff --git a/cogl/gl-prototypes/cogl-core-functions.h b/cogl/gl-prototypes/cogl-core-functions.h new file mode 100644 index 0000000..9210547 --- /dev/null +++ b/cogl/gl-prototypes/cogl-core-functions.h @@ -0,0 +1,189 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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, 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..6ac3c92 --- /dev/null +++ b/cogl/gl-prototypes/cogl-fixed-functions.h @@ -0,0 +1,104 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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, 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, glNormalPointer, + (GLenum type, GLsizei stride, const GLvoid *pointer)) +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, 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..d149185 --- /dev/null +++ b/cogl/gl-prototypes/cogl-gles1-functions.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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..66e7d0a --- /dev/null +++ b/cogl/gl-prototypes/cogl-gles2-functions.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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..a2b7abc --- /dev/null +++ b/cogl/gl-prototypes/cogl-glsl-functions.h @@ -0,0 +1,274 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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 function names in OpenGL 2.0 are different so we can't easily + just check for GL 2.0 */ +COGL_EXT_BEGIN (shaders_glsl, 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, glShaderSource, + (GLuint shader, + GLsizei count, + const char **string, + const GLint *length)) +COGL_EXT_FUNCTION (void, glCompileShader, + (GLuint shader)) +COGL_EXT_FUNCTION (void, glDeleteShader, + (GLuint shader)) +COGL_EXT_FUNCTION (void, glAttachShader, + (GLuint program, + GLuint shader)) +COGL_EXT_FUNCTION (void, glLinkProgram, + (GLuint program)) +COGL_EXT_FUNCTION (void, glUseProgram, + (GLuint program)) +COGL_EXT_FUNCTION (GLint, glGetUniformLocation, + (GLuint program, + const char *name)) +COGL_EXT_FUNCTION (void, glDeleteProgram, + (GLuint program)) +COGL_EXT_FUNCTION (void, glGetShaderInfoLog, + (GLuint shader, + GLsizei maxLength, + GLsizei *length, + char *infoLog)) +COGL_EXT_FUNCTION (void, glGetShaderiv, + (GLuint shader, + GLenum pname, + GLint *params)) + +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, 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, glGetProgramiv, + (GLuint program, + GLenum pname, + GLint *params)) + +COGL_EXT_FUNCTION (void, glGetProgramInfoLog, + (GLuint program, + GLsizei bufSize, + GLsizei *length, + char *infoLog)) + +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_FUNCTION (void, glGetActiveUniform, + (GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + GLchar* name)) +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 (void, glGetShaderSource, + (GLuint shader, + GLsizei bufsize, + GLsizei* length, + GLchar* source)) + +COGL_EXT_FUNCTION (GLboolean, glIsShader, + (GLuint shader)) +COGL_EXT_FUNCTION (GLboolean, glIsProgram, + (GLuint program)) + +COGL_EXT_FUNCTION (void, glValidateProgram, (GLuint program)) + +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..5cfde3a --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles-core-functions.h @@ -0,0 +1,141 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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, + 255, 255, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "\0", + "\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, + (GLuint 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..9d7fe46 --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles1-core-functions.h @@ -0,0 +1,71 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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..f39bd27 --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles2-core-functions.h @@ -0,0 +1,179 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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, + 255, 255, + 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, + 255, 255, + COGL_EXT_IN_GLES2, + "\0", + "\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..1aaef60 --- /dev/null +++ b/cogl/stb_image.c @@ -0,0 +1,3884 @@ +/* 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)(guint8 *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)(guint8 *output, guint8 const *y, guint8 const *cb, guint8 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_guint32[sizeof(guint32)==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 +{ + guint32 img_x, img_y; + int img_n, img_out_n; + + #ifndef STBI_NO_STDIO + FILE *img_file; + #endif + guint8 *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, guint8 const *buffer, int len) +{ +#ifndef STBI_NO_STDIO + s->img_file = NULL; +#endif + s->img_buffer = (guint8 *) buffer; + s->img_buffer_end = (guint8 *) 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 guint8 get8u(stbi *s) +{ + return (guint8) 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 guint32 get32(stbi *s) +{ + guint32 z = get16(s); + return (z << 16) + get16(s); +} + +static int get16le(stbi *s) +{ + int z = get8(s); + return z + (get8(s) << 8); +} + +static guint32 get32le(stbi *s) +{ + guint32 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 guint8 compute_y(int r, int g, int b) +{ + return (guint8) (((r*77) + (g*150) + (29*b)) >> 8); +} + +static unsigned char *convert_format(unsigned char *data, int img_n, int req_comp, guint x, guint 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 +{ + guint8 fast[1 << FAST_BITS]; + // weirdly, repacking this into AoS is a 10% speed loss, instead of a win + guint16 code[256]; + guint8 values[256]; + guint8 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]; + guint8 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; + guint8 *data; + void *raw_data; + guint8 *linebuf; + } img_comp[4]; + + guint32 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++] = (guint8) (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++] = (guint16) (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] = (guint8) 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 guint32 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 guint8 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 guint8 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 (guint8) 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(guint8 *out, int out_stride, short data[64], guint8 *dequantize) +{ + int i,val[64],*v=val; + guint8 *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(guint8 *out, int out_stride, short data[64], unsigned short *dequantize) +{ + int i,val[64],*v=val; + guint8 *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 guint8 get_marker(jpeg *j) +{ + guint8 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) { + guint8 *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 = (guint8*) (((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 guint8 *(*resample_row_func)(guint8 *out, guint8 *in0, guint8 *in1, + int w, int hs); + +#define div4(x) ((guint8) ((x) >> 2)) + +static guint8 *resample_row_1(guint8 *out, guint8 *in_near, guint8 *in_far, int w, int hs) +{ + return in_near; +} + +static guint8* resample_row_v_2(guint8 *out, guint8 *in_near, guint8 *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 guint8* resample_row_h_2(guint8 *out, guint8 *in_near, guint8 *in_far, int w, int hs) +{ + // need to generate two samples horizontally for every one in input + int i; + guint8 *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) ((guint8) ((x) >> 4)) + +static guint8 *resample_row_hv_2(guint8 *out, guint8 *in_near, guint8 *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 guint8 *resample_row_generic(guint8 *out, guint8 *in_near, guint8 *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(guint8 *out, const guint8 *y, const guint8 *pcb, const guint8 *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] = (guint8)r; + out[1] = (guint8)g; + out[2] = (guint8)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; + guint8 *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 guint8 *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; + guint i,j; + guint8 *output; + guint8 *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 = (guint8 *) 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 = (guint8 *) 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) { + guint8 *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) { + guint8 *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 { + guint8 *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 +{ + guint16 fast[1 << ZFAST_BITS]; + guint16 firstcode[16]; + int maxcode[17]; + guint16 firstsymbol[16]; + guint8 size[288]; + guint16 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, guint8 *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] = (guint16) code; + z->firstsymbol[i] = (guint16) 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] = (guint8)s; + z->value[c] = (guint16)i; + if (s <= ZFAST_BITS) { + int k = bit_reverse(next_code[s],s); + while (k < (1 << ZFAST_BITS)) { + z->fast[k] = (guint16) 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 +{ + guint8 *zbuffer, *zbuffer_end; + int num_bits; + guint32 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 { + guint8 *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 = (guint8 *) (a->zout - dist); + while (len--) + *a->zout++ = *p++; + } + } +} + +static int compute_huffman_codes(zbuf *a) +{ + static guint8 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; + guint8 lencodes[286+32+137];//padding for maximum single op + guint8 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]] = (guint8) 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++] = (guint8) 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) +{ + guint8 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++] = (guint8) (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++] = (guint8) 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 guint8 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 = (guint8 *) buffer; + a.zbuffer_end = (guint8 *) 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 = (guint8 *) ibuffer; + a.zbuffer_end = (guint8 *) 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 = (guint8 *) buffer; + a.zbuffer_end = (guint8 *) 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 = (guint8 *) ibuffer; + a.zbuffer_end = (guint8 *) 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 +{ + guint32 length; + guint32 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 guint8 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; + guint8 *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 guint8 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, guint8 *raw, guint32 raw_len, int out_n, guint32 x, guint32 y) +{ + stbi *s = &a->s; + guint32 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 = (guint8 *) 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) { + guint8 *cur = a->out + stride*j; + guint8 *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] = (guint8) (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] = (guint8) (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] = (guint8) (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] = (guint8) (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] = (guint8) (raw[k] + paeth(cur[k-out_n],0,0)); break; + } + #undef CASE + } + } + return 1; +} + +static int create_png_image(png *a, guint8 *raw, guint32 raw_len, int out_n, int interlaced) +{ + guint8 *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 = (guint8 *) 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, guint8 tc[3], int out_n) +{ + stbi *s = &z->s; + guint32 i, pixel_count = s->img_x * s->img_y; + guint8 *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, guint8 *palette, int len, int pal_img_n) +{ + guint32 i, pixel_count = a->s.img_x * a->s.img_y; + guint8 *p, *temp_out, *orig = a->out; + + p = (guint8 *) 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) +{ + guint8 palette[1024], pal_img_n=0; + guint8 has_trans=0, tc[3]; + guint32 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 != (guint32) s->img_n*2) return e("bad tRNS len","Corrupt PNG"); + has_trans = 1; + for (k=0; k < s->img_n; ++k) + tc[k] = (guint8) 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) { + guint8 *p; + if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; + while (ioff + c.length > idata_limit) + idata_limit *= 2; + p = (guint8 *) 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'): { + guint32 raw_len; + if (scan != SCAN_load) return 1; + if (z->idata == NULL) return e("no IDAT","Corrupt PNG"); + z->expanded = (guint8 *) 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] = (guint8) (c.type >> 24); + invalid_chunk[1] = (guint8) (c.type >> 16); + invalid_chunk[2] = (guint8) (c.type >> 8); + invalid_chunk[3] = (guint8) (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) +{ + guint8 *out; + unsigned int mr=0,mg=0,mb=0,ma=0, fake_a=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; + fake_a = 1; // @TODO: check for cases like alpha value is all 0 and switch it to 255 + } 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) { + guint32 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; + } + // 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; + guint8 *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++) { + guint8 *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) { + guint32 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++) { + guint8 *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 *s = buffer, c = '\0'; + + 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) { guint8 z = (guint8) x; fwrite(&z,1,1,f); } + +static void writefv(FILE *f, char *fmt, va_list v) +{ + while (*fmt) { + switch (*fmt++) { + case ' ': break; + case '1': { guint8 x = va_arg(v, int); write8(f,x); break; } + case '2': { gint16 x = va_arg(v, int); write8(f,x); write8(f,x>>8); break; } + case '4': { gint32 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) +{ + guint8 bg[3] = { 255, 0, 255}, px[3]; + guint32 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) { + guint8 *d = (guint8 *) 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/tesselator/GL/glu.h b/cogl/tesselator/GL/glu.h new file mode 100644 index 0000000..026ca5a --- /dev/null +++ b/cogl/tesselator/GL/glu.h @@ -0,0 +1,40 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + */ + +/* 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/tesselator/README b/cogl/tesselator/README new file mode 100644 index 0000000..66a6011 --- /dev/null +++ b/cogl/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/tesselator/dict-list.h b/cogl/tesselator/dict-list.h new file mode 100644 index 0000000..11331a7 --- /dev/null +++ b/cogl/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/tesselator/dict.c b/cogl/tesselator/dict.c new file mode 100644 index 0000000..49d4f75 --- /dev/null +++ b/cogl/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/tesselator/dict.h b/cogl/tesselator/dict.h new file mode 100644 index 0000000..11331a7 --- /dev/null +++ b/cogl/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/tesselator/geom.c b/cogl/tesselator/geom.c new file mode 100644 index 0000000..35b36a3 --- /dev/null +++ b/cogl/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/tesselator/geom.h b/cogl/tesselator/geom.h new file mode 100644 index 0000000..5cb76c7 --- /dev/null +++ b/cogl/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/tesselator/gluos.h b/cogl/tesselator/gluos.h new file mode 100644 index 0000000..d6c3ae9 --- /dev/null +++ b/cogl/tesselator/gluos.h @@ -0,0 +1 @@ +/* This is a stub header to avoid having to change tess.c */ diff --git a/cogl/tesselator/memalloc.h b/cogl/tesselator/memalloc.h new file mode 100644 index 0000000..0293e15 --- /dev/null +++ b/cogl/tesselator/memalloc.h @@ -0,0 +1,42 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + */ + +/* 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/tesselator/mesh.c b/cogl/tesselator/mesh.c new file mode 100644 index 0000000..36cb3a7 --- /dev/null +++ b/cogl/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/tesselator/mesh.h b/cogl/tesselator/mesh.h new file mode 100644 index 0000000..690c5f2 --- /dev/null +++ b/cogl/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/tesselator/normal.c b/cogl/tesselator/normal.c new file mode 100644 index 0000000..9a3bd43 --- /dev/null +++ b/cogl/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/tesselator/normal.h b/cogl/tesselator/normal.h new file mode 100644 index 0000000..c376ca4 --- /dev/null +++ b/cogl/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/tesselator/priorityq-heap.c b/cogl/tesselator/priorityq-heap.c new file mode 100644 index 0000000..52698b5 --- /dev/null +++ b/cogl/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/tesselator/priorityq-heap.h b/cogl/tesselator/priorityq-heap.h new file mode 100644 index 0000000..dc9aaef --- /dev/null +++ b/cogl/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/tesselator/priorityq-sort.h b/cogl/tesselator/priorityq-sort.h new file mode 100644 index 0000000..746cf5f --- /dev/null +++ b/cogl/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/tesselator/priorityq.c b/cogl/tesselator/priorityq.c new file mode 100644 index 0000000..c6b99cc --- /dev/null +++ b/cogl/tesselator/priorityq.c @@ -0,0 +1,260 @@ +/* + * 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->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/tesselator/priorityq.h b/cogl/tesselator/priorityq.h new file mode 100644 index 0000000..746cf5f --- /dev/null +++ b/cogl/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/tesselator/render.c b/cogl/tesselator/render.c new file mode 100644 index 0000000..bca836f --- /dev/null +++ b/cogl/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/tesselator/render.h b/cogl/tesselator/render.h new file mode 100644 index 0000000..a298c9a --- /dev/null +++ b/cogl/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/tesselator/sweep.c b/cogl/tesselator/sweep.c new file mode 100644 index 0000000..eca828f --- /dev/null +++ b/cogl/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/tesselator/sweep.h b/cogl/tesselator/sweep.h new file mode 100644 index 0000000..feb68b0 --- /dev/null +++ b/cogl/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/tesselator/tess.c b/cogl/tesselator/tess.c new file mode 100644 index 0000000..4a0e8de --- /dev/null +++ b/cogl/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/tesselator/tess.h b/cogl/tesselator/tess.h new file mode 100644 index 0000000..1624960 --- /dev/null +++ b/cogl/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/tesselator/tesselator.h b/cogl/tesselator/tesselator.h new file mode 100644 index 0000000..69a6ece --- /dev/null +++ b/cogl/tesselator/tesselator.h @@ -0,0 +1,121 @@ +/* + * 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" + +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/tesselator/tessmono.c b/cogl/tesselator/tessmono.c new file mode 100644 index 0000000..4d08440 --- /dev/null +++ b/cogl/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/tesselator/tessmono.h b/cogl/tesselator/tessmono.h new file mode 100644 index 0000000..8ee1b2f --- /dev/null +++ b/cogl/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/winsys/cogl-texture-pixmap-x11-private.h b/cogl/winsys/cogl-texture-pixmap-x11-private.h new file mode 100644 index 0000000..92b672c --- /dev/null +++ b/cogl/winsys/cogl-texture-pixmap-x11-private.h @@ -0,0 +1,80 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#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-handle.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; + CoglHandle tex; + + unsigned int depth; + Visual *visual; + unsigned int width; + unsigned int height; + + XImage *image; + + XShmSegmentInfo shm_info; + + Damage damage; + CoglTexturePixmapX11ReportLevel damage_report_level; + gboolean 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 */ + gboolean 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..0723ab3 --- /dev/null +++ b/cogl/winsys/cogl-texture-pixmap-x11.c @@ -0,0 +1,1031 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + * + * Authors: + * Neil Roberts + * Johan Bilien + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-debug.h" +#include "cogl-internal.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-rectangle-private.h" +#include "cogl-context-private.h" +#include "cogl-display-private.h" +#include "cogl-renderer-private.h" +#include "cogl-handle.h" +#include "cogl-winsys-private.h" +#include "cogl-pipeline-opengl-private.h" +#include "cogl-xlib.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); + +static const CoglTextureVtable cogl_texture_pixmap_x11_vtable; + +GQuark +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 gboolean +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) +{ + Display *display; + enum { DO_NOTHING, NEEDS_SUBTRACT, NEED_BOUNDING_BOX } handle_mode; + const CoglWinsysVtable *winsys; + + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + display = cogl_xlib_get_display (); + + 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_pixmap->width, + tex_pixmap->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) +{ + 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 (cogl_xlib_get_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, + guint32 pixmap, + gboolean automatic_updates, + GError **error) +{ + CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1); + Display *display = cogl_xlib_get_display (); + Window pixmap_root_window; + int pixmap_x, pixmap_y; + unsigned int pixmap_border_width; + CoglTexture *tex = COGL_TEXTURE (tex_pixmap); + XWindowAttributes window_attributes; + int damage_base; + const CoglWinsysVtable *winsys; + + _cogl_texture_init (tex, &cogl_texture_pixmap_x11_vtable); + + tex_pixmap->pixmap = pixmap; + tex_pixmap->image = NULL; + tex_pixmap->shm_info.shmid = -1; + tex_pixmap->tex = COGL_INVALID_HANDLE; + tex_pixmap->damage_owned = FALSE; + tex_pixmap->damage = 0; + + if (!XGetGeometry (display, pixmap, &pixmap_root_window, + &pixmap_x, &pixmap_y, + &tex_pixmap->width, &tex_pixmap->height, + &pixmap_border_width, &tex_pixmap->depth)) + { + g_free (tex_pixmap); + g_set_error (error, + COGL_TEXTURE_PIXMAP_X11_ERROR, + COGL_TEXTURE_PIXMAP_X11_ERROR_X11, + "Unable to query pixmap size"); + return NULL; + } + + /* 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); + g_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 = tex_pixmap->width; + tex_pixmap->damage_rect.y1 = 0; + tex_pixmap->damage_rect.y2 = tex_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; + + return _cogl_texture_pixmap_x11_handle_new (tex_pixmap); +} + +/* 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) +{ + XImage *dummy_image; + Display *display; + + display = cogl_xlib_get_display (); + + 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_pixmap->width, + tex_pixmap->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); +} + +gboolean +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, + guint32 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 void +_cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap) +{ + Display *display; + Visual *visual; + CoglPixelFormat image_format; + XImage *image; + int src_x, src_y; + int x, y, width, height; + + display = cogl_xlib_get_display (); + 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 == COGL_INVALID_HANDLE) + { + CoglPixelFormat texture_format; + + texture_format = (tex_pixmap->depth >= 32 + ? COGL_PIXEL_FORMAT_RGBA_8888_PRE + : COGL_PIXEL_FORMAT_RGB_888); + + tex_pixmap->tex = cogl_texture_new_with_size (tex_pixmap->width, + tex_pixmap->height, + COGL_TEXTURE_NONE, + 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_pixmap->width, tex_pixmap->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); + + cogl_texture_set_region (tex_pixmap->tex, + src_x, src_y, + x, y, width, height, + image->width, + image->height, + image_format, + image->bytes_per_line, + (const guint8 *) image->data); + + /* 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, + gboolean 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, + gboolean 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 CoglHandle +_cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglHandle 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 COGL_INVALID_HANDLE; +} + +static gboolean +_cogl_texture_pixmap_x11_set_region (CoglTexture *tex, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int dst_width, + unsigned int dst_height, + CoglBitmap *bmp) +{ + /* This doesn't make much sense for texture from pixmap so it's not + supported */ + return FALSE; +} + +static gboolean +_cogl_texture_pixmap_x11_get_data (CoglTexture *tex, + CoglPixelFormat format, + unsigned int rowstride, + guint8 *data) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglHandle child_tex; + + 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); + CoglHandle 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_pixmap->width; + int height = tex_pixmap->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); + CoglHandle child_tex; + + child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + return cogl_texture_get_max_waste (child_tex); +} + +static gboolean +_cogl_texture_pixmap_x11_is_sliced (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglHandle child_tex; + + child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + return cogl_texture_is_sliced (child_tex); +} + +static gboolean +_cogl_texture_pixmap_x11_can_hardware_repeat (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglHandle child_tex; + + 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); + CoglHandle child_tex; + + 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); + CoglHandle child_tex; + + 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 gboolean +_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); + CoglHandle child_tex; + + 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_set_filters (CoglTexture *tex, + GLenum min_filter, + GLenum mag_filter) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglHandle child_tex; + + child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + _cogl_texture_set_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); + CoglHandle 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); + CoglHandle child_tex; + + 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_set_wrap_mode_parameters (CoglTexture *tex, + GLenum wrap_mode_s, + GLenum wrap_mode_t, + GLenum wrap_mode_p) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + CoglHandle child_tex; + + child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + /* Forward on to the child texture */ + _cogl_texture_set_wrap_mode_parameters (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); + CoglHandle child_tex; + + 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); + CoglHandle child_tex; + + child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap); + + return _cogl_texture_get_gl_format (child_tex); +} + +static int +_cogl_texture_pixmap_x11_get_width (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + + return tex_pixmap->width; +} + +static int +_cogl_texture_pixmap_x11_get_height (CoglTexture *tex) +{ + CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex); + + return tex_pixmap->height; +} + +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) +{ + _COGL_GET_CONTEXT (ctxt, NO_RETVAL); + + 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 (cogl_xlib_get_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_handle_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 = + { + _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_set_filters, + _cogl_texture_pixmap_x11_pre_paint, + _cogl_texture_pixmap_x11_ensure_non_quad_rendering, + _cogl_texture_pixmap_x11_set_wrap_mode_parameters, + _cogl_texture_pixmap_x11_get_format, + _cogl_texture_pixmap_x11_get_gl_format, + _cogl_texture_pixmap_x11_get_width, + _cogl_texture_pixmap_x11_get_height, + _cogl_texture_pixmap_x11_get_type, + NULL /* is_foreign */ + }; diff --git a/cogl/winsys/cogl-texture-pixmap-x11.h b/cogl/winsys/cogl-texture-pixmap-x11.h new file mode 100644 index 0000000..604011c --- /dev/null +++ b/cogl/winsys/cogl-texture-pixmap-x11.h @@ -0,0 +1,192 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_TEXTURE_PIXMAP_X11_H +#define __COGL_TEXTURE_PIXMAP_X11_H + +#define __COGL_H_INSIDE__ + +#include + +#include + +G_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) + +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: + * + * #GError 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; + +GQuark 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 #GError 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, + guint32 pixmap, + gboolean automatic_updates, + GError **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 + */ +gboolean +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, + guint32 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 + */ +gboolean +cogl_is_texture_pixmap_x11 (void *object); + +#endif /* COGL_ENABLE_EXPERIMENTAL_API */ + +G_END_DECLS + +#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..571e74d --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-android-private.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..2efa6b2 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-android.c @@ -0,0 +1,247 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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; + gboolean 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 gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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 gboolean +_cogl_winsys_egl_context_created (CoglDisplay *display, + GError **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, + (NativeWindowType) android_native_window, + NULL); + if (egl_display->egl_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create EGL window surface"; + goto fail; + } + + if (!eglMakeCurrent (egl_renderer->edpy, + 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: + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +static gboolean +_cogl_winsys_egl_display_setup (CoglDisplay *display, + GError **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 gboolean +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + GError **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) + { + g_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 gboolean 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..e979724 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-feature-functions.h @@ -0,0 +1,105 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + */ + +/* 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_END () +#endif +COGL_WINSYS_FEATURE_BEGIN (surfaceless_opengl, + "KHR\0", + "surfaceless_opengl\0", + COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL) +COGL_WINSYS_FEATURE_END () +COGL_WINSYS_FEATURE_BEGIN (surfaceless_gles1, + "KHR\0", + "surfaceless_gles1\0", + COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES1) +COGL_WINSYS_FEATURE_END () +COGL_WINSYS_FEATURE_BEGIN (surfaceless_gles2, + "KHR\0", + "surfaceless_gles2\0", + COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES2) +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..8db5804 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-gdl-private.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..1f7a2c3 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-gdl.c @@ -0,0 +1,374 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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 +{ + gboolean gdl_initialized; +} CoglRendererGDL; + +typedef struct _CoglDisplayGDL +{ + int egl_surface_width; + int egl_surface_height; + gboolean 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 gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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) + { + g_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) + { + g_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 gboolean +_cogl_winsys_egl_context_created (CoglDisplay *display, + GError **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, + (NativeWindowType) display->gdl_plane, + NULL); + + if (egl_display->egl_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create EGL window surface"; + goto fail; + } + + if (!eglMakeCurrent (egl_renderer->edpy, + 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: + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +static gboolean +gdl_plane_init (CoglDisplay *display, GError **error) +{ + gboolean 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) + { + g_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) + { + g_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) + { + g_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) + { + g_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 gboolean +_cogl_winsys_egl_display_setup (CoglDisplay *display, + GError **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 gboolean +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + GError **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) + { + g_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 gboolean 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..a4992a3 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-kms-private.h @@ -0,0 +1,34 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + * 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..ecddb43 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-kms.c @@ -0,0 +1,588 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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 "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" + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +typedef struct _CoglRendererKMS +{ + int fd; + struct gbm_device *gbm; +} CoglRendererKMS; + +typedef struct _CoglDisplayKMS +{ + drmModeConnector *connector; + drmModeEncoder *encoder; + drmModeModeInfo mode; + drmModeCrtcPtr saved_crtc; + int width, height; +} CoglDisplayKMS; + +typedef struct _CoglOnscreenKMS +{ + uint32_t fb_id[2]; + struct gbm_bo *bo[2]; + unsigned int fb, color_rb[2], depth_rb; + EGLImageKHR image[2]; + int current_frame; +} 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); + + g_slice_free (CoglRendererKMS, kms_renderer); + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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 = open (device_name, O_RDWR); + if (kms_renderer->fd < 0) + { + /* Probably permissions error */ + g_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) + { + g_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) + { + g_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; + + return TRUE; + +egl_terminate: + eglTerminate (egl_renderer->edpy); +destroy_gbm_device: + gbm_device_destroy (kms_renderer->gbm); +close_fd: + close (kms_renderer->fd); + + _cogl_winsys_renderer_disconnect (renderer); + + return FALSE; +} + +static gboolean +_cogl_winsys_egl_display_setup (CoglDisplay *display, + GError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + CoglDisplayKMS *kms_display; + CoglRendererEGL *egl_renderer = display->renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + CoglEGLWinsysFeature surfaceless_feature = 0; + const char *surfaceless_feature_name = ""; + drmModeRes *resources; + drmModeConnector *connector; + drmModeEncoder *encoder; + int i; + + kms_display = g_slice_new0 (CoglDisplayKMS); + egl_display->platform = kms_display; + + switch (display->renderer->driver) + { + case COGL_DRIVER_GL: + surfaceless_feature = COGL_EGL_WINSYS_FEATURE_SURFACELESS_OPENGL; + surfaceless_feature_name = "opengl"; + break; + case COGL_DRIVER_GLES1: + surfaceless_feature = COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES1; + surfaceless_feature_name = "gles1"; + break; + case COGL_DRIVER_GLES2: + surfaceless_feature = COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES2; + surfaceless_feature_name = "gles2"; + break; + case COGL_DRIVER_ANY: + g_return_val_if_reached (FALSE); + } + + if (!(egl_renderer->private_features & surfaceless_feature)) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "EGL_KHR_surfaceless_%s extension not available", + surfaceless_feature_name); + return FALSE; + } + + resources = drmModeGetResources (kms_renderer->fd); + if (!resources) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "drmModeGetResources failed"); + return FALSE; + } + + for (i = 0; i < resources->count_connectors; i++) + { + connector = drmModeGetConnector (kms_renderer->fd, + resources->connectors[i]); + if (connector == NULL) + continue; + + if (connector->connection == DRM_MODE_CONNECTED && + connector->count_modes > 0) + break; + + drmModeFreeConnector(connector); + } + + if (i == resources->count_connectors) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "No currently active connector found"); + return FALSE; + } + + for (i = 0; i < resources->count_encoders; i++) + { + encoder = drmModeGetEncoder (kms_renderer->fd, resources->encoders[i]); + + if (encoder == NULL) + continue; + + if (encoder->encoder_id == connector->encoder_id) + break; + + drmModeFreeEncoder (encoder); + } + + kms_display->saved_crtc = drmModeGetCrtc (kms_renderer->fd, + encoder->crtc_id); + + kms_display->connector = connector; + kms_display->encoder = encoder; + kms_display->mode = connector->modes[0]; + kms_display->width = kms_display->mode.hdisplay; + kms_display->height = kms_display->mode.vdisplay; + + return TRUE; +} + +static void +_cogl_winsys_egl_display_destroy (CoglDisplay *display) +{ + CoglDisplayEGL *egl_display = display->winsys; + + g_slice_free (CoglDisplayKMS, egl_display->platform); +} + +static gboolean +_cogl_winsys_egl_try_create_context (CoglDisplay *display, + EGLint *attribs, + GError **error) +{ + CoglRenderer *renderer = display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglDisplayEGL *egl_display = display->winsys; + + egl_display->egl_context = eglCreateContext (egl_renderer->edpy, + NULL, + EGL_NO_CONTEXT, + attribs); + + if (egl_display->egl_context == NULL) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Couldn't create EGL context"); + return FALSE; + } + + if (!eglMakeCurrent (egl_renderer->edpy, + EGL_NO_SURFACE, + EGL_NO_SURFACE, + egl_display->egl_context)) + { + g_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; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + + /* Restore the saved CRTC - this failing should not propagate an error */ + if (kms_display->saved_crtc) + { + int ret = drmModeSetCrtc (kms_renderer->fd, + kms_display->saved_crtc->crtc_id, + kms_display->saved_crtc->buffer_id, + kms_display->saved_crtc->x, + kms_display->saved_crtc->y, + &kms_display->connector->connector_id, 1, + &kms_display->saved_crtc->mode); + if (ret) + g_critical (G_STRLOC ": Error restoring saved CRTC"); + + drmModeFreeCrtc (kms_display->saved_crtc); + } +} + +static void +_cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen) +{ + 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; + + if (drmModeSetCrtc (kms_renderer->fd, + kms_display->encoder->crtc_id, + kms_onscreen->fb_id[kms_onscreen->current_frame], + 0, 0, + &kms_display->connector->connector_id, + 1, + &kms_display->mode) != 0) + { + g_error (G_STRLOC ": Setting CRTC failed"); + } + + /* Update frame that we're drawing to be the new one */ + kms_onscreen->current_frame ^= 1; + + context->glBindFramebuffer (GL_FRAMEBUFFER_EXT, kms_onscreen->fb); + context->glFramebufferRenderbuffer (GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + GL_RENDERBUFFER_EXT, + kms_onscreen-> + color_rb[kms_onscreen->current_frame]); + + if (context->glCheckFramebufferStatus (GL_FRAMEBUFFER_EXT) != + GL_FRAMEBUFFER_COMPLETE) + { + g_error (G_STRLOC ": FBO not complete"); + } +} + +static gboolean +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + GError **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; + int i; + + _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE); + + onscreen->winsys = g_slice_new0 (CoglOnscreenEGL); + egl_onscreen = onscreen->winsys; + + kms_onscreen = g_slice_new0 (CoglOnscreenKMS); + egl_onscreen->platform = kms_onscreen; + + context->glGenRenderbuffers (2, kms_onscreen->color_rb); + + for (i = 0; i < 2; i++) + { + uint32_t handle, stride; + + kms_onscreen->bo[i] = + gbm_bo_create (kms_renderer->gbm, + kms_display->mode.hdisplay, kms_display->mode.vdisplay, + GBM_BO_FORMAT_XRGB8888, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + if (!kms_onscreen->bo[i]) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to allocate buffer"); + return FALSE; + } + + kms_onscreen->image[i] = + _cogl_egl_create_image (context, + EGL_NATIVE_PIXMAP_KHR, + kms_onscreen->bo[i], + NULL); + + if (kms_onscreen->image[i] == EGL_NO_IMAGE_KHR) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to create EGL image"); + return FALSE; + } + + context->glBindRenderbuffer (GL_RENDERBUFFER_EXT, + kms_onscreen->color_rb[i]); + context->glEGLImageTargetRenderbufferStorage (GL_RENDERBUFFER, + kms_onscreen->image[i]); + context->glBindRenderbuffer (GL_RENDERBUFFER_EXT, 0); + + handle = gbm_bo_get_handle (kms_onscreen->bo[i]).u32; + stride = gbm_bo_get_pitch (kms_onscreen->bo[i]); + + if (drmModeAddFB (kms_renderer->fd, + kms_display->mode.hdisplay, + kms_display->mode.vdisplay, + 24, 32, + stride, + handle, + &kms_onscreen->fb_id[i]) != 0) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to create framebuffer from buffer"); + return FALSE; + } + } + + context->glGenFramebuffers (1, &kms_onscreen->fb); + context->glBindFramebuffer (GL_FRAMEBUFFER_EXT, kms_onscreen->fb); + + context->glGenRenderbuffers (1, &kms_onscreen->depth_rb); + context->glBindRenderbuffer (GL_RENDERBUFFER_EXT, kms_onscreen->depth_rb); + context->glRenderbufferStorage (GL_RENDERBUFFER_EXT, + GL_DEPTH_COMPONENT16, + kms_display->mode.hdisplay, + kms_display->mode.vdisplay); + context->glBindRenderbuffer (GL_RENDERBUFFER_EXT, 0); + + context->glFramebufferRenderbuffer (GL_FRAMEBUFFER_EXT, + GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, + kms_onscreen->depth_rb); + + kms_onscreen->current_frame = 0; + _cogl_winsys_onscreen_swap_buffers (onscreen); + + _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; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererKMS *kms_renderer = egl_renderer->platform; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenKMS *kms_onscreen; + int i; + + /* If we never successfully allocated then there's nothing to do */ + if (egl_onscreen == NULL) + return; + + kms_onscreen = egl_onscreen->platform; + + context->glBindFramebuffer (GL_FRAMEBUFFER_EXT, kms_onscreen->fb); + context->glFramebufferRenderbuffer (GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + GL_RENDERBUFFER_EXT, + 0); + context->glDeleteRenderbuffers(2, kms_onscreen->color_rb); + context->glFramebufferRenderbuffer (GL_FRAMEBUFFER_EXT, + GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, + 0); + context->glDeleteRenderbuffers(1, &kms_onscreen->depth_rb); + + for (i = 0; i < 2; i++) + { + drmModeRmFB (kms_renderer->fd, kms_onscreen->fb_id[i]); + _cogl_egl_destroy_image (context, kms_onscreen->image[i]); + gbm_bo_destroy (kms_onscreen->bo[i]); + } + + g_slice_free (CoglOnscreenKMS, kms_onscreen); + g_slice_free (CoglOnscreenEGL, onscreen->winsys); + onscreen->winsys = NULL; +} + +static void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglDisplayEGL *egl_display = context->display->winsys; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + + eglMakeCurrent (egl_renderer->edpy, + EGL_NO_SURFACE, + EGL_NO_SURFACE, + egl_display->egl_context); +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ + _cogl_winsys_onscreen_bind (onscreen); +} + +static const CoglWinsysEGLVtable +_cogl_winsys_egl_vtable = + { + .display_setup = _cogl_winsys_egl_display_setup, + .display_destroy = _cogl_winsys_egl_display_destroy, + .try_create_context = _cogl_winsys_egl_try_create_context, + .cleanup_context = _cogl_winsys_egl_cleanup_context + }; + +const CoglWinsysVtable * +_cogl_winsys_egl_kms_get_vtable (void) +{ + static gboolean 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 */ + + vtable = *_cogl_winsys_egl_get_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; + vtable.onscreen_bind = _cogl_winsys_onscreen_bind; + + /* The KMS winsys doesn't support swap region */ + vtable.onscreen_swap_region = NULL; + vtable.onscreen_swap_buffers = _cogl_winsys_onscreen_swap_buffers; + + vtable.onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled; + + vtable_inited = TRUE; + } + + return &vtable; +} + +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; +} 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..c125236 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-null-private.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..f0b9200 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-null.c @@ -0,0 +1,240 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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; + gboolean 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 gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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 gboolean +_cogl_winsys_egl_context_created (CoglDisplay *display, + GError **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, + (NativeWindowType) NULL, + NULL); + if (egl_display->egl_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create EGL window surface"; + goto fail; + } + + if (!eglMakeCurrent (egl_renderer->edpy, + 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: + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +static gboolean +_cogl_winsys_egl_display_setup (CoglDisplay *display, + GError **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 gboolean +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + GError **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) + { + g_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 gboolean 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..6658278 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-private.h @@ -0,0 +1,157 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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" + +typedef struct _CoglWinsysEGLVtable +{ + gboolean + (* display_setup) (CoglDisplay *display, + GError **error); + void + (* display_destroy) (CoglDisplay *display); + + gboolean + (* try_create_context) (CoglDisplay *display, + EGLint *attribs, + GError **error); + + gboolean + (* context_created) (CoglDisplay *display, + GError **error); + + void + (* cleanup_context) (CoglDisplay *display); + + gboolean + (* context_init) (CoglContext *context, GError **error); + + void + (* context_deinit) (CoglContext *context); + + gboolean + (* onscreen_init) (CoglOnscreen *onscreen, + EGLConfig config, + GError **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_SURFACELESS_OPENGL =1L<<3, + COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES1 =1L<<4, + COGL_EGL_WINSYS_FEATURE_SURFACELESS_GLES2 =1L<<5 +} CoglEGLWinsysFeature; + +typedef struct _CoglRendererEGL +{ + CoglEGLWinsysFeature private_features; + + EGLDisplay edpy; + + EGLint egl_version_major; + EGLint egl_version_minor; + + /* 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; + gboolean found_egl_config; + gboolean stencil_disabled; + + /* Platform specific display data */ + void *platform; +} CoglDisplayEGL; + +typedef struct _CoglContextEGL +{ + EGLSurface current_surface; +} CoglContextEGL; + +typedef struct _CoglOnscreenEGL +{ + EGLSurface egl_surface; + + /* Platform specific data */ + void *platform; +} CoglOnscreenEGL; + +const CoglWinsysVtable * +_cogl_winsys_egl_get_vtable (void); + +#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 + +gboolean +_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, + GError **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..870047c --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-wayland-private.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..a9d2129 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-wayland.c @@ -0,0 +1,598 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Robert Bragg + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#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" + +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; +} CoglRendererWayland; + +typedef struct _CoglDisplayWayland +{ + struct wl_surface *wayland_surface; + struct wl_egl_window *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; + gboolean has_pending; +} CoglOnscreenWayland; + +static void +display_handle_global_cb (struct wl_display *display, + uint32_t id, + const char *interface, + uint32_t version, + void *data) +{ + CoglRendererEGL *egl_renderer = (CoglRendererEGL *)data; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + + if (strcmp (interface, "wl_compositor") == 0) + wayland_renderer->wayland_compositor = + wl_display_bind (display, id, &wl_compositor_interface); + else if (strcmp(interface, "wl_shell") == 0) + wayland_renderer->wayland_shell = + wl_display_bind (display, id, &wl_shell_interface); +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + + eglTerminate (egl_renderer->edpy); + + g_slice_free (CoglRendererWayland, egl_renderer->platform); + g_slice_free (CoglRendererEGL, egl_renderer); +} + +static gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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; + + /* The EGL API doesn't provide for a way to explicitly select a + * platform when the driver can support multiple. Mesa allows + * selection using an environment variable though so that's what + * we're doing here... */ + g_setenv ("EGL_PLATFORM", "wayland", 1); + + if (renderer->foreign_wayland_display) + { + wayland_renderer->wayland_display = renderer->foreign_wayland_display; + /* XXX: For now we have to assume that if a foreign display is + * given then a foreign compositor and shell must also have been + * given because wayland doesn't provide a way to + * retrospectively be notified of the these objects. */ + g_assert (renderer->foreign_wayland_compositor); + g_assert (renderer->foreign_wayland_shell); + wayland_renderer->wayland_compositor = + renderer->foreign_wayland_compositor; + wayland_renderer->wayland_shell = renderer->foreign_wayland_shell; + } + else + { + wayland_renderer->wayland_display = wl_display_connect (NULL); + if (!wayland_renderer->wayland_display) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to connect wayland display"); + goto error; + } + + wl_display_add_global_listener (wayland_renderer->wayland_display, + display_handle_global_cb, + egl_renderer); + } + + /* + * Ensure that that we've received the messages setting up the + * compostor and shell object. This is better than just + * wl_display_iterate since it will always ensure that something + * is available to be read + */ + while (!(wayland_renderer->wayland_compositor && + wayland_renderer->wayland_shell)) + wl_display_roundtrip (wayland_renderer->wayland_display); + + egl_renderer->edpy = + eglGetDisplay ((EGLNativeDisplayType) wayland_renderer->wayland_display); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static gboolean +_cogl_winsys_egl_display_setup (CoglDisplay *display, + GError **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 gboolean +_cogl_winsys_egl_context_created (CoglDisplay *display, + GError **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->wayland_surface = + wl_compositor_create_surface (wayland_renderer->wayland_compositor); + if (!wayland_display->wayland_surface) + { + error_message= "Failed to create a dummy wayland surface"; + goto fail; + } + + wayland_display->wayland_egl_native_window = + wl_egl_window_create (wayland_display->wayland_surface, + 1, + 1); + if (!wayland_display->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->wayland_egl_native_window, + NULL); + if (egl_display->dummy_surface == EGL_NO_SURFACE) + { + error_message= "Unable to eglMakeCurrent with dummy surface"; + goto fail; + } + + if (!eglMakeCurrent (egl_renderer->edpy, + egl_display->dummy_surface, + egl_display->dummy_surface, + egl_display->egl_context)) + { + error_message = "Unable to eglMakeCurrent with dummy surface"; + goto fail; + } + + return TRUE; + + fail: + g_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) +{ + 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->wayland_egl_native_window) + { + wl_egl_window_destroy (wayland_display->wayland_egl_native_window); + wayland_display->wayland_egl_native_window = NULL; + } + + if (wayland_display->wayland_surface) + { + wl_surface_destroy (wayland_display->wayland_surface); + wayland_display->wayland_surface = NULL; + } +} + +static gboolean +_cogl_winsys_egl_context_init (CoglContext *context, + GError **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); + + return TRUE; +} + +static gboolean +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + GError **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; + + wayland_onscreen->wayland_surface = + wl_compositor_create_surface (wayland_renderer->wayland_compositor); + if (!wayland_onscreen->wayland_surface) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Error while creating wayland surface for CoglOnscreen"); + return FALSE; + } + + wayland_onscreen->wayland_shell_surface = + wl_shell_get_shell_surface (wayland_renderer->wayland_shell, + wayland_onscreen->wayland_surface); + + 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) + { + g_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); + + wl_shell_surface_set_toplevel (wayland_onscreen->wayland_shell_surface); + + return TRUE; +} + +static void +_cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen) +{ + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + + 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 (wayland_onscreen->wayland_surface) + { + wl_surface_destroy (wayland_onscreen->wayland_surface); + wayland_onscreen->wayland_surface = NULL; + } + + g_slice_free (CoglOnscreenWayland, wayland_onscreen); +} + +static void +_cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = fb->context; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + 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 (fb, + wayland_onscreen->pending_width, + wayland_onscreen->pending_height); + wayland_onscreen->has_pending = FALSE; + } + + /* chain-up */ + parent_vtable->onscreen_swap_buffers (onscreen); + + /* + * The implementation of eglSwapBuffers may do a flush however the semantics + * of eglSwapBuffers on Wayland has changed in the past. So to be safe to + * the implementation changing we should explicitly ensure all messages are + * sent. + */ + wl_display_flush (wayland_renderer->wayland_display); +} + +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; +} + +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; +} + +void +cogl_wayland_renderer_set_foreign_compositor (CoglRenderer *renderer, + struct wl_compositor *compositor) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->foreign_wayland_compositor = compositor; +} + +struct wl_compositor * +cogl_wayland_renderer_get_compositor (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); + + if (renderer->foreign_wayland_compositor) + return renderer->foreign_wayland_compositor; + else if (renderer->connected) + { + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + return wayland_renderer->wayland_compositor; + } + else + return NULL; +} + +void +cogl_wayland_renderer_set_foreign_shell (CoglRenderer *renderer, + struct wl_shell *shell) +{ + _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); + + /* NB: Renderers are considered immutable once connected */ + _COGL_RETURN_IF_FAIL (!renderer->connected); + + renderer->foreign_wayland_shell = shell; +} + +struct wl_shell * +cogl_wayland_renderer_get_shell (CoglRenderer *renderer) +{ + _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); + + if (renderer->foreign_wayland_shell) + return renderer->foreign_wayland_shell; + else if (renderer->connected) + { + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglRendererWayland *wayland_renderer = egl_renderer->platform; + return wayland_renderer->wayland_shell; + } + else + return NULL; +} + +struct wl_surface * +cogl_wayland_onscreen_get_surface (CoglOnscreen *onscreen) +{ + CoglFramebuffer *fb; + + fb = COGL_FRAMEBUFFER (onscreen); + if (fb->allocated) + { + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + return wayland_onscreen->wayland_surface; + } + else + return NULL; +} + +struct wl_shell_surface * +cogl_wayland_onscreen_get_shell_surface (CoglOnscreen *onscreen) +{ + CoglFramebuffer *fb; + + fb = COGL_FRAMEBUFFER (onscreen); + if (fb->allocated) + { + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform; + return wayland_onscreen->wayland_shell_surface; + } + else + return NULL; +} + +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; + } + } + 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 gboolean 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 = _cogl_winsys_onscreen_swap_buffers; + + 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..ea2a9cd --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-x11-private.h @@ -0,0 +1,32 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..55cbbc2 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl-x11.c @@ -0,0 +1,758 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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" + +#define COGL_ONSCREEN_X11_EVENT_MASK StructureNotifyMask + +static const CoglWinsysEGLVtable _cogl_winsys_egl_vtable; + +typedef struct _CoglDisplayXlib +{ + Window dummy_xwin; +} CoglDisplayXlib; + +typedef struct _CoglOnscreenXlib +{ + Window xwin; + gboolean 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, guint32 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 CoglFilterReturn +event_filter_cb (XEvent *xevent, void *data) +{ + CoglContext *context = data; + + if (xevent->type == ConfigureNotify) + { + CoglOnscreen *onscreen = + find_onscreen_for_xid (context, xevent->xconfigure.window); + + if (onscreen) + { + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + _cogl_framebuffer_winsys_update_size (framebuffer, + xevent->xconfigure.width, + xevent->xconfigure.height); + } + } + + 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 gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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 ((NativeDisplayType) 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 gboolean +_cogl_winsys_egl_display_setup (CoglDisplay *display, + GError **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 gboolean +_cogl_winsys_egl_context_init (CoglContext *context, + GError **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); + + return TRUE; +} + +static void +_cogl_winsys_egl_context_deinit (CoglContext *context) +{ + cogl_xlib_renderer_remove_filter (context->display->renderer, + event_filter_cb, + context); +} + +static gboolean +_cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, + EGLConfig egl_config, + GError **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)); + g_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) + { + g_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)); + g_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, + (NativeWindowType) 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, + gboolean 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 guint32 +_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 gboolean +_cogl_winsys_egl_context_created (CoglDisplay *display, + GError **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; + + 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); + + XFree (xvisinfo); + + egl_display->dummy_surface = + eglCreateWindowSurface (egl_renderer->edpy, + egl_display->egl_config, + (NativeWindowType) xlib_display->dummy_xwin, + NULL); + + if (egl_display->dummy_surface == EGL_NO_SURFACE) + { + error_message = "Unable to create an EGL surface"; + goto fail; + } + + if (!eglMakeCurrent (egl_renderer->edpy, + egl_display->dummy_surface, + egl_display->dummy_surface, + egl_display->egl_context)) + { + error_message = "Unable to eglMakeCurrent with dummy surface"; + goto fail; + } + + return TRUE; + +fail: + g_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); +} + +static void +_cogl_winsys_poll_get_info (CoglContext *context, + CoglPollFD **poll_fds, + int *n_poll_fds, + gint64 *timeout) +{ + _cogl_xlib_renderer_poll_get_info (context->display->renderer, + poll_fds, + n_poll_fds, + timeout); +} + +static void +_cogl_winsys_poll_dispatch (CoglContext *context, + const CoglPollFD *poll_fds, + int n_poll_fds) +{ + _cogl_xlib_renderer_poll_dispatch (context->display->renderer, + poll_fds, + n_poll_fds); +} + +#ifdef EGL_KHR_image_pixmap + +static gboolean +_cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapEGL *egl_tex_pixmap; + EGLint attribs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; + CoglPixelFormat texture_format; + CoglRendererEGL *egl_renderer; + + /* FIXME: It should be possible to get to a CoglContext from any + * CoglTexture pointer. */ + _COGL_GET_CONTEXT (ctx, FALSE); + + egl_renderer = ctx->display->renderer->winsys; + + if (!(egl_renderer->private_features & + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP) || + !(ctx->private_feature_flags & + 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_pixmap->width, + tex_pixmap->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 gboolean +_cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, + gboolean needs_mipmap) +{ + if (needs_mipmap) + return FALSE; + + return TRUE; +} + +static void +_cogl_winsys_texture_pixmap_x11_damage_notify (CoglTexturePixmapX11 *tex_pixmap) +{ +} + +static CoglHandle +_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 gboolean 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_x11_get_window_xid = + _cogl_winsys_onscreen_x11_get_window_xid; + + vtable.xlib_get_visual_info = _cogl_winsys_xlib_get_visual_info; + + vtable.poll_get_info = _cogl_winsys_poll_get_info; + vtable.poll_dispatch = _cogl_winsys_poll_dispatch; + +#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..5d96ac4 --- /dev/null +++ b/cogl/winsys/cogl-winsys-egl.c @@ -0,0 +1,719 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#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-private.h" + +#include +#include +#include +#include +#include + +#include + +#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 CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name) +{ + void *ptr; + + 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; + int i; + + egl_extensions = eglQueryString (egl_renderer->edpy, EGL_EXTENSIONS); + + 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 */ + egl_extensions, + egl_renderer)) + { + egl_renderer->private_features |= + winsys_feature_data[i].feature_flags_private; + } +} + +gboolean +_cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, + GError **error) +{ + CoglRendererEGL *egl_renderer = renderer->winsys; + + if (!eglInitialize (egl_renderer->edpy, + &egl_renderer->egl_version_major, + &egl_renderer->egl_version_minor)) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Couldn't initialize EGL"); + return FALSE; + } + + check_egl_extensions (renderer); + + return TRUE; +} + +static gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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, + gboolean needs_stencil_override, + 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); + + attributes[i++] = EGL_STENCIL_SIZE; + attributes[i++] = needs_stencil_override ? 2 : 0; + + 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 ? + 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); +} + +static gboolean +try_create_context (CoglDisplay *display, + gboolean with_stencil_buffer, + GError **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[3]; + 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) + eglBindAPI (EGL_OPENGL_API); + + 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; + + /* Divert to the platform implementation if one is defined */ + if (egl_renderer->platform_vtable->try_create_context) + return egl_renderer->platform_vtable-> + try_create_context (display, attribs, error); + + egl_attributes_from_framebuffer_config (display, + &display->onscreen_template->config, + with_stencil_buffer, + 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; + + 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: + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "%s", error_message); + return FALSE; +} + +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) + { + eglMakeCurrent (egl_renderer->edpy, 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 gboolean +create_context (CoglDisplay *display, GError **error) +{ + CoglDisplayEGL *egl_display = display->winsys; + + /* Note: we don't just rely on eglChooseConfig to correctly + * report that the driver doesn't support a stencil buffer + * because we've seen PVR drivers that claim stencil buffer + * support according to the EGLConfig but then later fail + * when trying to create a context with such a config. + */ + if (try_create_context (display, TRUE, error)) + { + egl_display->stencil_disabled = FALSE; + return TRUE; + } + else + { + g_clear_error (error); + cleanup_context (display); + egl_display->stencil_disabled = TRUE; + return try_create_context (display, FALSE, error); + } +} + +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 gboolean +_cogl_winsys_display_setup (CoglDisplay *display, + GError **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; + + 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 (!create_context (display, error)) + goto error; + + egl_display->found_egl_config = TRUE; + + return TRUE; + +error: + _cogl_winsys_display_destroy (display); + return FALSE; +} + +static gboolean +_cogl_winsys_context_init (CoglContext *context, GError **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->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); +} + +static gboolean +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + GError **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; + gboolean need_stencil = + egl_display->stencil_disabled ? FALSE : framebuffer->config.need_stencil; + + _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE); + + egl_attributes_from_framebuffer_config (display, + &framebuffer->config, + need_stencil, + attributes); + + status = eglChooseConfig (egl_renderer->edpy, + attributes, + &egl_config, 1, + &config_count); + if (status != EGL_TRUE || config_count == 0) + { + g_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; + 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) + { + 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 void +_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) +{ + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = fb->context; + CoglDisplayEGL *egl_display = context->display->winsys; + CoglRenderer *renderer = context->display->renderer; + CoglRendererEGL *egl_renderer = renderer->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + CoglContextEGL *egl_context = context->winsys; + + if (egl_context->current_surface == egl_onscreen->egl_surface) + return; + + eglMakeCurrent (egl_renderer->edpy, + egl_onscreen->egl_surface, + egl_onscreen->egl_surface, + egl_display->egl_context); + egl_context->current_surface = egl_onscreen->egl_surface; + + if (fb->config.swap_throttled) + eglSwapInterval (egl_renderer->edpy, 1); + else + eglSwapInterval (egl_renderer->edpy, 0); +} + +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 (CoglOnscreen *onscreen) +{ + 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); + + eglSwapBuffers (egl_renderer->edpy, egl_onscreen->egl_surface); +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ + CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; + CoglContextEGL *egl_context = context->winsys; + CoglOnscreenEGL *egl_onscreen = onscreen->winsys; + + if (egl_context->current_surface != egl_onscreen->egl_surface) + return; + + egl_context->current_surface = EGL_NO_SURFACE; + + _cogl_winsys_onscreen_bind (onscreen); +} + +static EGLDisplay +_cogl_winsys_context_egl_get_egl_display (CoglContext *context) +{ + CoglRendererEGL *egl_renderer = context->display->renderer->winsys; + + return egl_renderer->edpy; +} + +static CoglWinsysVtable _cogl_winsys_vtable = + { + .constraints = COGL_RENDERER_CONSTRAINT_USES_EGL, + + /* 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_egl_get_egl_display = + _cogl_winsys_context_egl_get_egl_display, + .onscreen_init = _cogl_winsys_onscreen_init, + .onscreen_deinit = _cogl_winsys_onscreen_deinit, + .onscreen_bind = _cogl_winsys_onscreen_bind, + .onscreen_swap_buffers = _cogl_winsys_onscreen_swap_buffers, + .onscreen_swap_region = _cogl_winsys_onscreen_swap_region, + .onscreen_update_swap_throttled = + _cogl_winsys_onscreen_update_swap_throttled, + }; + +/* 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 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..71fd827 --- /dev/null +++ b/cogl/winsys/cogl-winsys-glx-feature-functions.h @@ -0,0 +1,113 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010 Intel Corporation. + * + * 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, see + * . + * + * + */ + +/* 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_public_feature_flags, + * implied_private_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 + */ + +COGL_WINSYS_FEATURE_BEGIN (texture_from_pixmap, + "EXT\0", + "texture_from_pixmap\0", + 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 (video_sync, + "SGI\0", + "video_sync\0", + 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 (swap_control, + "SGI\0", + "swap_control\0", + 0, + 0, + COGL_WINSYS_FEATURE_SWAP_THROTTLE) +COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval, + (int interval)) +COGL_WINSYS_FEATURE_END () + +COGL_WINSYS_FEATURE_BEGIN (copy_sub_buffer, + "MESA\0", + "copy_sub_buffer\0", + 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 (swap_event, + "INTEL\0", + "swap_event\0", + 0, + 0, + COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT) +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..5844e18 --- /dev/null +++ b/cogl/winsys/cogl-winsys-glx-private.h @@ -0,0 +1,30 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..79800ac --- /dev/null +++ b/cogl/winsys/cogl-winsys-glx.c @@ -0,0 +1,2082 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Robert Bragg + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#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-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 +#include +#include +#include + +#include + +#include +#include +#include + +#define COGL_ONSCREEN_X11_EVENT_MASK StructureNotifyMask +#define MAX_GLX_CONFIG_ATTRIBS 30 + +typedef struct _CoglContextGLX +{ + GLXDrawable current_drawable; +} CoglContextGLX; + +typedef struct _CoglOnscreenXlib +{ + Window xwin; + gboolean is_foreign_xwin; +} CoglOnscreenXlib; + +typedef struct _CoglOnscreenGLX +{ + CoglOnscreenXlib _parent; + GLXDrawable glxwin; + guint32 last_swap_vsync_counter; + GList *swap_callbacks; + gboolean pending_swap_notify; +} CoglOnscreenGLX; + +typedef struct _CoglTexturePixmapGLX +{ + GLXPixmap glx_pixmap; + gboolean has_mipmap_space; + gboolean can_mipmap; + + CoglHandle glx_tex; + + gboolean bind_tex_image_queued; + gboolean pixmap_bound; +} CoglTexturePixmapGLX; + +/* 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_glx_feature_ ## name ## _funcs[] = { +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglGLXRenderer, pf_ ## 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(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_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) +{ + CoglGLXRenderer *glx_renderer = renderer->winsys; + + return glx_renderer->glXGetProcAddress ((const GLubyte *) name); +} + +static CoglOnscreen * +find_onscreen_for_xid (CoglContext *context, guint32 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 +notify_swap_buffers (CoglContext *context, GLXDrawable drawable) +{ + CoglOnscreen *onscreen = find_onscreen_for_xid (context, (guint32)drawable); + CoglDisplay *display = context->display; + CoglGLXDisplay *glx_display = display->winsys; + 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 */ + glx_display->pending_swap_notify = TRUE; + glx_onscreen->pending_swap_notify = TRUE; +} + +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) + { + CoglOnscreen *onscreen = + find_onscreen_for_xid (context, xevent->xconfigure.window); + + if (onscreen) + { + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + + _cogl_framebuffer_winsys_update_size (framebuffer, + xevent->xconfigure.width, + xevent->xconfigure.height); + } + + /* 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->drawable); + + /* remove SwapComplete events from the queue */ + return COGL_FILTER_REMOVE; + } +#endif /* GLX_INTEL_swap_event */ + + 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 gboolean +resolve_core_glx_functions (CoglRenderer *renderer, + GError **error) +{ + CoglGLXRenderer *glx_renderer; + + glx_renderer = renderer->winsys; + + if (!g_module_symbol (glx_renderer->libgl_module, "glXCreatePixmap", + (void **) &glx_renderer->glXCreatePixmap) || + !g_module_symbol (glx_renderer->libgl_module, "glXDestroyPixmap", + (void **) &glx_renderer->glXDestroyPixmap) || + !g_module_symbol (glx_renderer->libgl_module, "glXChooseFBConfig", + (void **) &glx_renderer->glXChooseFBConfig) || + !g_module_symbol (glx_renderer->libgl_module, "glXCreateNewContext", + (void **) &glx_renderer->glXCreateNewContext) || + !g_module_symbol (glx_renderer->libgl_module, "glXGetFBConfigAttrib", + (void **) &glx_renderer->glXGetFBConfigAttrib) || + !g_module_symbol (glx_renderer->libgl_module, "glXQueryVersion", + (void **) &glx_renderer->glXQueryVersion) || + !g_module_symbol (glx_renderer->libgl_module, "glXDestroyContext", + (void **) &glx_renderer->glXDestroyContext) || + !g_module_symbol (glx_renderer->libgl_module, "glXMakeContextCurrent", + (void **) &glx_renderer->glXMakeContextCurrent) || + !g_module_symbol (glx_renderer->libgl_module, "glXSwapBuffers", + (void **) &glx_renderer->glXSwapBuffers) || + !g_module_symbol (glx_renderer->libgl_module, "glXQueryExtension", + (void **) &glx_renderer->glXQueryExtension) || + !g_module_symbol (glx_renderer->libgl_module, "glXIsDirect", + (void **) &glx_renderer->glXIsDirect) || + !g_module_symbol (glx_renderer->libgl_module, "glXGetVisualFromFBConfig", + (void **) &glx_renderer->glXGetVisualFromFBConfig) || + !g_module_symbol (glx_renderer->libgl_module, "glXSelectEvent", + (void **) &glx_renderer->glXSelectEvent) || + !g_module_symbol (glx_renderer->libgl_module, "glXCreateWindow", + (void **) &glx_renderer->glXCreateWindow) || + !g_module_symbol (glx_renderer->libgl_module, "glXGetFBConfigs", + (void **) &glx_renderer->glXGetFBConfigs) || + !g_module_symbol (glx_renderer->libgl_module, "glXDestroyWindow", + (void **) &glx_renderer->glXDestroyWindow) || + !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_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to resolve required GLX symbol"); + return FALSE; + } + + return TRUE; +} + +static gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **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) + { + g_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) + { + g_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)) + { + g_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)) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "XServer appears to lack required GLX 1.2 support"); + goto error; + } + + glx_renderer->dri_fd = -1; + + return TRUE; + +error: + _cogl_winsys_renderer_disconnect (renderer); + return FALSE; +} + +static gboolean +update_winsys_features (CoglContext *context, GError **error) +{ + CoglGLXDisplay *glx_display = context->display->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (context->display->renderer); + CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; + const char *glx_extensions; + int default_screen; + int i; + + _COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE); + + if (!_cogl_context_update_features (context, error)) + return FALSE; + + memset (context->winsys_features, 0, sizeof (context->winsys_features)); + + default_screen = DefaultScreen (xlib_renderer->xdpy); + glx_extensions = + glx_renderer->glXQueryExtensionsString (xlib_renderer->xdpy, + default_screen); + + COGL_NOTE (WINSYS, " GLX Extensions: %s", glx_extensions); + + 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); + + for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++) + if (_cogl_feature_check (context->display->renderer, + "GLX", winsys_feature_data + i, 0, 0, + COGL_DRIVER_GL, /* the driver isn't used */ + glx_extensions, + glx_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); + } + + /* Note: the GLX_SGI_video_sync spec explicitly states this extension + * only works for direct contexts. */ + if (!glx_renderer->is_direct) + { + glx_renderer->pf_glXGetVideoSync = NULL; + glx_renderer->pf_glXWaitVideoSync = NULL; + } + + if (glx_renderer->pf_glXWaitVideoSync) + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_VBLANK_WAIT, + TRUE); + + if (glx_renderer->pf_glXCopySubBuffer || context->glBlitFramebuffer) + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SWAP_REGION, TRUE); + + /* 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_SWAP_BUFFERS_EVENT)) + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, + 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 gboolean +find_fbconfig (CoglDisplay *display, + CoglFramebufferConfig *config, + GLXFBConfig *config_ret, + GError **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]; + gboolean 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) + { + g_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; + } + } + + g_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 gboolean +create_context (CoglDisplay *display, GError **error) +{ + CoglGLXDisplay *glx_display = display->winsys; + CoglXlibRenderer *xlib_renderer = + _cogl_xlib_renderer_get_data (display->renderer); + CoglGLXRenderer *glx_renderer = display->renderer->winsys; + gboolean support_transparent_windows = + display->onscreen_template->config.swap_chain->has_alpha; + GLXFBConfig config; + GError *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) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to find suitable fbconfig for the GLX context: %s", + fbconfig_error->message); + g_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); + + glx_display->glx_context = + glx_renderer->glXCreateNewContext (xlib_renderer->xdpy, + config, + GLX_RGBA_TYPE, + NULL, + True); + if (glx_display->glx_context == NULL) + { + g_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) + { + g_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)) + { + g_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 gboolean +_cogl_winsys_display_setup (CoglDisplay *display, + GError **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 gboolean +_cogl_winsys_context_init (CoglContext *context, GError **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 gboolean +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + GError **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; + GError *fbconfig_error = NULL; + + _COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE); + + if (!find_fbconfig (display, &framebuffer->config, + &fbconfig, + &fbconfig_error)) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to find suitable fbconfig for the GLX context: %s", + fbconfig_error->message); + g_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)); + g_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) + { + g_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)); + g_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_SWAP_BUFFERS_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; + 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; + + /* If we never successfully allocated then there's nothing to do */ + if (glx_onscreen == NULL) + return; + + _cogl_xlib_renderer_trap_errors (context->display->renderer, &old_state); + + 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->pf_glXSwapInterval) + { + CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen); + if (fb->config.swap_throttled) + glx_renderer->pf_glXSwapInterval (1); + else + glx_renderer->pf_glXSwapInterval (0); + } + + XSync (xlib_renderer->xdpy, False); + + /* FIXME: We should be reporting a GError 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_vblank (void) +{ + CoglGLXRenderer *glx_renderer; + + _COGL_GET_CONTEXT (ctx, NO_RETVAL); + + glx_renderer = ctx->display->renderer->winsys; + + if (glx_renderer->pf_glXGetVideoSync) + { + guint32 current_count; + + glx_renderer->pf_glXGetVideoSync (¤t_count); + glx_renderer->pf_glXWaitVideoSync (2, + (current_count + 1) % 2, + ¤t_count); + } +} + +static guint32 +_cogl_winsys_get_vsync_counter (void) +{ + guint32 video_sync_count; + CoglGLXRenderer *glx_renderer; + + _COGL_GET_CONTEXT (ctx, 0); + + glx_renderer = ctx->display->renderer->winsys; + + glx_renderer->pf_glXGetVideoSync (&video_sync_count); + + return video_sync_count; +} + +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; + guint32 end_frame_vsync_counter = 0; + gboolean have_counter; + gboolean can_wait; + + /* + * 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. + */ + gboolean blit_sub_buffer_is_synchronized = + _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED); + + 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]; + 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. + */ + context->glFinish (); + + if (blit_sub_buffer_is_synchronized && have_counter && can_wait) + { + end_frame_vsync_counter = _cogl_winsys_get_vsync_counter (); + + /* 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 (); + } + else if (can_wait) + _cogl_winsys_wait_for_vblank (); + + if (glx_renderer->pf_glXCopySubBuffer) + { + Display *xdpy = xlib_renderer->xdpy; + int i; + for (i = 0; i < n_rectangles; i++) + { + int *rect = &rectangles[4 * i]; + glx_renderer->pf_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 */ + 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; +} + +static void +_cogl_winsys_onscreen_swap_buffers (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; + CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + gboolean 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) + { + guint32 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 (); + + if (!glx_renderer->pf_glXSwapInterval) + { + gboolean 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 + */ + context->glFinish (); + + if (have_counter && can_wait) + { + if (glx_onscreen->last_swap_vsync_counter == + end_frame_vsync_counter) + _cogl_winsys_wait_for_vblank (); + } + else if (can_wait) + _cogl_winsys_wait_for_vblank (); + } + } + 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 (); +} + +static guint32 +_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, + gboolean 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); +} + +/* 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 gboolean +get_fbconfig_for_depth (CoglContext *context, + unsigned int depth, + GLXFBConfig *fbconfig_ret, + gboolean *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; + gboolean 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; + + 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 gboolean +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 gboolean +try_create_glx_pixmap (CoglContext *context, + CoglTexturePixmapX11 *tex_pixmap, + gboolean 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 gboolean +_cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap; + + /* FIXME: It should be possible to get to a CoglContext from any + * CoglTexture pointer. */ + _COGL_GET_CONTEXT (ctx, FALSE); + + 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 = COGL_INVALID_HANDLE; + + 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->pf_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; + + /* 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; + + glx_tex_pixmap = tex_pixmap->winsys; + + free_glx_pixmap (ctx, glx_tex_pixmap); + + if (glx_tex_pixmap->glx_tex) + cogl_handle_unref (glx_tex_pixmap->glx_tex); + + tex_pixmap->winsys = NULL; + g_free (glx_tex_pixmap); +} + +static gboolean +_cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, + gboolean needs_mipmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; + CoglGLXRenderer *glx_renderer; + + /* FIXME: It should be possible to get to a CoglContext from any CoglTexture + * pointer. */ + _COGL_GET_CONTEXT (ctx, FALSE); + + /* 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 == COGL_INVALID_HANDLE) + { + CoglPixelFormat texture_format; + GError *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_rectangle_new_with_size (ctx, + tex_pixmap->width, + tex_pixmap->height, + texture_format, + &error); + + if (glx_tex_pixmap->glx_tex) + 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); + g_error_free (error); + free_glx_pixmap (ctx, glx_tex_pixmap); + return FALSE; + } + } + else + { + glx_tex_pixmap->glx_tex = + cogl_texture_2d_new_with_size (ctx, + tex_pixmap->width, + tex_pixmap->height, + texture_format, + NULL); + + if (glx_tex_pixmap->glx_tex) + 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", + tex_pixmap); + 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_handle_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->pf_glXReleaseTexImage (xlib_renderer->xdpy, + glx_tex_pixmap->glx_pixmap, + GLX_FRONT_LEFT_EXT); + + glx_renderer->pf_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 CoglHandle +_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) +{ + CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; + + return glx_tex_pixmap->glx_tex; +} + +static void +_cogl_winsys_poll_get_info (CoglContext *context, + CoglPollFD **poll_fds, + int *n_poll_fds, + gint64 *timeout) +{ + CoglDisplay *display = context->display; + CoglGLXDisplay *glx_display = display->winsys; + + _cogl_xlib_renderer_poll_get_info (context->display->renderer, + poll_fds, + n_poll_fds, + timeout); + + /* If we've already got a pending swap notify then we'll dispatch + immediately */ + if (glx_display->pending_swap_notify) + *timeout = 0; +} + +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); + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; + + if (glx_onscreen->pending_swap_notify) + { + _cogl_onscreen_notify_swap_buffers (onscreen); + glx_onscreen->pending_swap_notify = FALSE; + } + } +} + +static void +_cogl_winsys_poll_dispatch (CoglContext *context, + const CoglPollFD *poll_fds, + int n_poll_fds) +{ + CoglDisplay *display = context->display; + CoglGLXDisplay *glx_display = display->winsys; + + _cogl_xlib_renderer_poll_dispatch (context->display->renderer, + poll_fds, + n_poll_fds); + + if (glx_display->pending_swap_notify) + { + g_list_foreach (context->framebuffers, + flush_pending_swap_notify_cb, + NULL); + glx_display->pending_swap_notify = FALSE; + } +} + +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, + .display_setup = _cogl_winsys_display_setup, + .display_destroy = _cogl_winsys_display_destroy, + .context_init = _cogl_winsys_context_init, + .context_deinit = _cogl_winsys_context_deinit, + .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 = _cogl_winsys_onscreen_swap_buffers, + .onscreen_swap_region = _cogl_winsys_onscreen_swap_region, + .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, + + .poll_get_info = _cogl_winsys_poll_get_info, + .poll_dispatch = _cogl_winsys_poll_dispatch, + + /* 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; +} diff --git a/cogl/winsys/cogl-winsys-private.h b/cogl/winsys/cogl-winsys-private.h new file mode 100644 index 0000000..0e6c78b --- /dev/null +++ b/cogl/winsys/cogl-winsys-private.h @@ -0,0 +1,166 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009 Intel Corporation. + * + * 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, see . + * + * + */ + +#ifndef __COGL_WINSYS_PRIVATE_H +#define __COGL_WINSYS_PRIVATE_H + +#include "cogl-renderer.h" +#include "cogl-onscreen.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 + +#include "cogl-poll.h" + +GQuark +_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, +} 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); + + gboolean + (*renderer_connect) (CoglRenderer *renderer, GError **error); + + void + (*renderer_disconnect) (CoglRenderer *renderer); + + gboolean + (*display_setup) (CoglDisplay *display, GError **error); + + void + (*display_destroy) (CoglDisplay *display); + + gboolean + (*context_init) (CoglContext *context, GError **error); + + void + (*context_deinit) (CoglContext *context); + + gboolean + (*onscreen_init) (CoglOnscreen *onscreen, GError **error); + + void + (*onscreen_deinit) (CoglOnscreen *onscreen); + + void + (*onscreen_bind) (CoglOnscreen *onscreen); + + void + (*onscreen_swap_buffers) (CoglOnscreen *onscreen); + + void + (*onscreen_update_swap_throttled) (CoglOnscreen *onscreen); + + void + (*onscreen_set_visibility) (CoglOnscreen *onscreen, + gboolean visibility); + + /* Optional functions */ + + void + (*onscreen_swap_region) (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles); + +#ifdef COGL_HAS_EGL_SUPPORT + EGLDisplay + (*context_egl_get_egl_display) (CoglContext *context); +#endif + +#ifdef COGL_HAS_XLIB_SUPPORT + XVisualInfo * + (*xlib_get_visual_info) (void); +#endif + + guint32 + (*onscreen_x11_get_window_xid) (CoglOnscreen *onscreen); + +#ifdef COGL_HAS_WIN32_SUPPORT + HWND + (*onscreen_win32_get_window) (CoglOnscreen *onscreen); +#endif + + void + (*poll_get_info) (CoglContext *context, + CoglPollFD **poll_fds, + int *n_poll_fds, + gint64 *timeout); + void + (*poll_dispatch) (CoglContext *context, + const CoglPollFD *poll_fds, + int n_poll_fds); + +#ifdef COGL_HAS_XLIB_SUPPORT + gboolean + (*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap); + void + (*texture_pixmap_x11_free) (CoglTexturePixmapX11 *tex_pixmap); + + gboolean + (*texture_pixmap_x11_update) (CoglTexturePixmapX11 *tex_pixmap, + gboolean needs_mipmap); + + void + (*texture_pixmap_x11_damage_notify) (CoglTexturePixmapX11 *tex_pixmap); + + CoglHandle + (*texture_pixmap_x11_get_texture) (CoglTexturePixmapX11 *tex_pixmap); +#endif + +} CoglWinsysVtable; + +gboolean +_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..2f0066d --- /dev/null +++ b/cogl/winsys/cogl-winsys-sdl-private.h @@ -0,0 +1,30 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..deda045 --- /dev/null +++ b/cogl/winsys/cogl-winsys-sdl.c @@ -0,0 +1,286 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + * 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" + +typedef struct _CoglRendererSdl +{ + int stub; +} CoglRendererSdl; + +typedef struct _CoglDisplaySdl +{ + SDL_Surface *surface; + gboolean has_onscreen; +} CoglDisplaySdl; + +static CoglFuncPtr +_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, + const char *name) +{ + return SDL_GL_GetProcAddress (name); +} + +static void +_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) +{ + SDL_Quit (); + + g_slice_free (CoglRendererSdl, renderer->winsys); +} + +static gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **error) +{ + if (renderer->driver != COGL_DRIVER_GL) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "The SDL winsys only supports the GL driver"); + return FALSE; + } + + if (SDL_Init (SDL_INIT_VIDEO) == -1) + { + g_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); + + 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 gboolean +_cogl_winsys_display_setup (CoglDisplay *display, + GError **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); + + /* 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, 0, SDL_OPENGL); + + if (sdl_display->surface == NULL) + { + g_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 gboolean +_cogl_winsys_context_init (CoglContext *context, GError **error) +{ + 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->has_onscreen = FALSE; +} + +static gboolean +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + GError **error) +{ + CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); + CoglContext *context = framebuffer->context; + CoglDisplay *display = context->display; + CoglDisplaySdl *sdl_display = display->winsys; + int width, height; + + if (sdl_display->has_onscreen) + { + g_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); + + /* Try to update the video size using the onscreen size */ + if (width != sdl_display->surface->w || + height != sdl_display->surface->h) + { + sdl_display->surface = SDL_SetVideoMode (width, height, 0, SDL_OPENGL); + + if (sdl_display->surface == NULL) + { + g_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->has_onscreen = TRUE; + + return TRUE; +} + +static void +_cogl_winsys_onscreen_swap_buffers (CoglOnscreen *onscreen) +{ + 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, + gboolean visibility) +{ + /* SDL doesn't appear to provide a way to set this */ +} + +const CoglWinsysVtable * +_cogl_winsys_sdl_get_vtable (void) +{ + static gboolean 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 = _cogl_winsys_onscreen_swap_buffers; + 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..3e837b2 --- /dev/null +++ b/cogl/winsys/cogl-winsys-stub-private.h @@ -0,0 +1,30 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..1801b66 --- /dev/null +++ b/cogl/winsys/cogl-winsys-stub.c @@ -0,0 +1,187 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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) +{ + 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 gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **error) +{ + renderer->winsys = &_cogl_winsys_stub_dummy_ptr; + return TRUE; +} + +static void +_cogl_winsys_display_destroy (CoglDisplay *display) +{ + display->winsys = NULL; +} + +static gboolean +_cogl_winsys_display_setup (CoglDisplay *display, + GError **error) +{ + display->winsys = &_cogl_winsys_stub_dummy_ptr; + return TRUE; +} + +static gboolean +_cogl_winsys_context_init (CoglContext *context, GError **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 gboolean +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + GError **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 (CoglOnscreen *onscreen) +{ +} + +static void +_cogl_winsys_onscreen_update_swap_throttled (CoglOnscreen *onscreen) +{ +} + +static void +_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, + gboolean visibility) +{ +} + +const CoglWinsysVtable * +_cogl_winsys_stub_get_vtable (void) +{ + static gboolean 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 = _cogl_winsys_onscreen_swap_buffers; + 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..d22d9c3 --- /dev/null +++ b/cogl/winsys/cogl-winsys-wgl-feature-functions.h @@ -0,0 +1,38 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see + * . + * + * + * 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..fd41eb4 --- /dev/null +++ b/cogl/winsys/cogl-winsys-wgl-private.h @@ -0,0 +1,30 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2012 Intel Corporation. + * + * 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, see . + * + * + */ + +#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..198b1d8 --- /dev/null +++ b/cogl/winsys/cogl-winsys-wgl.c @@ -0,0 +1,897 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2010,2011 Intel Corporation. + * + * 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, see + * . + * + * + * Authors: + * Neil Roberts + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "cogl.h" + +#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" + +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; + gboolean 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) +{ + 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 */ + 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 (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); + } + } + } + + return COGL_FILTER_CONTINUE; +} + +static gboolean +_cogl_winsys_renderer_connect (CoglRenderer *renderer, + GError **error) +{ + renderer->winsys = g_slice_new0 (CoglRendererWgl); + + return TRUE; +} + +static LRESULT CALLBACK +window_proc (HWND hwnd, UINT umsg, + WPARAM wparam, LPARAM lparam) +{ + gboolean 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 gboolean +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 gboolean +create_window_class (CoglDisplay *display, GError **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) + { + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to register window class"); + return FALSE; + } + + return TRUE; +} + +static gboolean +create_context (CoglDisplay *display, GError **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) + { + g_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)) + { + g_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) + { + g_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 gboolean +_cogl_winsys_display_setup (CoglDisplay *display, + GError **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 */ + if (_cogl_check_extension ("WGL_EXT_swap_control", + (char *) ctx->glGetString (GL_EXTENSIONS))) + return "WGL_EXT_swap_control"; + + return NULL; +} + +static gboolean +update_winsys_features (CoglContext *context, GError **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) + { + 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, + wgl_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); + } + } + + return TRUE; +} + +static gboolean +_cogl_winsys_context_init (CoglContext *context, GError **error) +{ + CoglContextWgl *wgl_context; + + wgl_context = 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 gboolean +_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, + GError **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) + { + g_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)) + { + g_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 (CoglOnscreen *onscreen) +{ + 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, + gboolean visibility) +{ + CoglOnscreenWin32 *win32_onscreen = onscreen->winsys; + + ShowWindow (win32_onscreen->hwnd, visibility ? SW_SHOW : SW_HIDE); +} + +const CoglWinsysVtable * +_cogl_winsys_wgl_get_vtable (void) +{ + static gboolean 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 = _cogl_winsys_onscreen_swap_buffers; + 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..fccf233 --- /dev/null +++ b/cogl/winsys/cogl-winsys.c @@ -0,0 +1,46 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2007,2008,2009,2010 Intel Corporation. + * + * 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, see + * . + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "cogl-context-private.h" + +#include + +GQuark +_cogl_winsys_error_quark (void) +{ + return g_quark_from_static_string ("cogl-winsys-error-quark"); +} + +/* FIXME: we should distinguish renderer and context features */ +gboolean +_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..6db96f5 --- /dev/null +++ b/config-custom.h @@ -0,0 +1,35 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2011 Intel Corporation. + * + * 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, see . + */ + +/* 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..20009f3 --- /dev/null +++ b/config.h.in @@ -0,0 +1,152 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Can use Cogl 2.0 API internally */ +#undef COGL_ENABLE_EXPERIMENTAL_2_0_API + +/* Can use experimental API internally */ +#undef COGL_ENABLE_EXPERIMENTAL_API + +/* 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 + +/* The prefix for our gettext translation domains. */ +#undef GETTEXT_PACKAGE + +/* 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 + +/* 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 + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* Defined if the GL library shouldn't be dlopened */ +#undef HAVE_DIRECTLY_LINKED_GL_LIBRARY + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Have libdrm support */ +#undef HAVE_DRM + +/* 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 header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `ffs' function. */ +#undef HAVE_FFS + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the header file. */ +#undef HAVE_GLES_EGL_H + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* 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 header file. */ +#undef HAVE_MEMORY_H + +/* 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 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 header file. */ +#undef HAVE_SYS_STAT_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_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* 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 + +/* 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 + +/* 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..7e25539 --- /dev/null +++ b/config.h.win32 @@ -0,0 +1,162 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* 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 + +/* Cogl supports OpenGL using the WGL API */ +#define COGL_HAS_WIN32_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" + +/* 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*/ + +/* 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_DLFCN_H*/ + +/* Have libdrm support */ +/*#undef HAVE_DRM*/ + +/* 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 header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `ffs' function. */ +/*#undef HAVE_FFS*/ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#define HAVE_GETTEXT 1 + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_GLES_EGL_H*/ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 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 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 header file. */ +#define HAVE_MEMORY_H 1 + +/* 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 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 header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_UNISTD_H 1 +#endif + +/* 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 2.0.0" + +/* 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 "2.0.0" + +/* 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*/ + +/* 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..28dcce8 --- /dev/null +++ b/config.h.win32.in @@ -0,0 +1,162 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* 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 + +/* Cogl supports OpenGL using the WGL API */ +#define COGL_HAS_WIN32_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@" + +/* 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*/ + +/* 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_DLFCN_H*/ + +/* Have libdrm support */ +/*#undef HAVE_DRM*/ + +/* 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 header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `ffs' function. */ +/*#undef HAVE_FFS*/ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#define HAVE_GETTEXT 1 + +/* Define to 1 if you have the header file. */ +/*#undef HAVE_GLES_EGL_H*/ + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 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 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 header file. */ +#define HAVE_MEMORY_H 1 + +/* 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 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 header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#ifndef _MSC_VER +#define HAVE_UNISTD_H 1 +#endif + +/* 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_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_VERSION@" + +/* 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*/ + +/* 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..d65a1cd --- /dev/null +++ b/configure @@ -0,0 +1,20661 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for cogl 1.10.2. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 + +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" + 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 : + # 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 + export CONFIG_SHELL + 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+"$@"} +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_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; } + + # 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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +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 + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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.10.2' +PACKAGE_STRING='cogl 1.10.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 +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 +GLIB_COMPILE_RESOURCES +GLIB_MKENUMS +GOBJECT_QUERY +GLIB_GENMARSHAL +GLIB_LIBS +GLIB_CFLAGS +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 +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 +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +SED +LIBTOOL +SUPPORT_XLIB_FALSE +SUPPORT_XLIB_TRUE +SUPPORT_X11_FALSE +SUPPORT_X11_TRUE +X11_TESTS_FALSE +X11_TESTS_TRUE +DUMMY_LIBS +DUMMY_CFLAGS +SUPPORT_SDL_FALSE +SUPPORT_SDL_TRUE +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 +SUPPORT_EGL_PLATFORM_KMS_FALSE +SUPPORT_EGL_PLATFORM_KMS_TRUE +SUPPORT_EGL_PLATFORM_WAYLAND_FALSE +SUPPORT_EGL_PLATFORM_WAYLAND_TRUE +SUPPORT_EGL_PLATFORM_GDL_FALSE +SUPPORT_EGL_PLATFORM_GDL_TRUE +SUPPORT_EGL_PLATFORM_POWERVR_NULL_FALSE +SUPPORT_EGL_PLATFORM_POWERVR_NULL_TRUE +SUPPORT_WGL_FALSE +SUPPORT_WGL_TRUE +SUPPORT_GLX_FALSE +SUPPORT_GLX_TRUE +HAVE_GLES2 +COGL_GLES2_LIBNAME +HAVE_GLES1 +COGL_GLES1_LIBNAME +HAVE_GL +COGL_GL_LIBNAME +COGL_DRIVER_GLES_SUPPORTED_FALSE +COGL_DRIVER_GLES_SUPPORTED_TRUE +COGL_DRIVER_GL_SUPPORTED_FALSE +COGL_DRIVER_GL_SUPPORTED_TRUE +COGL_EGL_INCLUDES +USE_GLIB_FALSE +USE_GLIB_TRUE +INSTALL_EXAMPLES_FALSE +INSTALL_EXAMPLES_TRUE +BUILD_COGL_PANGO_FALSE +BUILD_COGL_PANGO_TRUE +PROFILE_FALSE +PROFILE_TRUE +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +COGL_DEBUG_CFLAGS +OS_QUARTZ_FALSE +OS_QUARTZ_TRUE +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +OS_WIN32_FALSE +OS_WIN32_TRUE +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +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__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 +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 +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_silent_rules +enable_dependency_tracking +enable_debug +enable_cairo +enable_profile +enable_maintainer_flags +enable_deprecated +enable_gdk_pixbuf +enable_quartz_image +enable_cogl_pango +enable_examples_install +enable_glib +enable_gles1 +enable_gles2 +enable_gl +with_gl_libname +with_gles1_libname +with_gles2_libname +enable_glx +enable_wgl +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 +enable_sdl +enable_static +enable_shared +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_nls +enable_rpath +with_libiconv_prefix +with_libintl_prefix +with_html_dir +enable_gtk_doc +enable_gtk_doc_html +enable_gtk_doc_pdf +enable_glibtest +enable_introspection +with_x +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +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 +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 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + 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.10.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.10.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-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0') + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-debug=[no/yes] Control Cogl debugging level [default=no] + --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] + --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-cogl-pango=[no/yes] + Enable pango support [default=yes] + --enable-examples-install=[no/yes] + Enable installation of examples [default=no] + --enable-glib=[no/yes] Enable glib support [default=yes] + --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-glx=[no/yes] Enable support GLX [default=auto] + --enable-wgl=[no/yes] Enable support for WGL [default=auto] + --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-sdl=[no/yes] Enable support SDL [default=no] + --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) + --disable-nls do not use Native Language Support + --disable-rpath do not hardcode runtime library paths + --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-glibtest do not try to compile and run a test GLIB program + --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-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-pic 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-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-html-dir=PATH path to installed docs + --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 + 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 + 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 + 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.10.2 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 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_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 || + $as_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_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 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 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 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 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 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 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.10.2, which was +generated by GNU Autoconf 2.68. 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" + + + + + + + + + + + + +GLIB_REQ_VERSION=2.28.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 + + +# 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.11' + +# 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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 ( + 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 + rm -f conftest.file + 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 + + 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; } +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"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +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 --run true"; then + am_missing_run="$MISSING --run " +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 + +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.10.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"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + + +{ $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; } +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar plaintar pax cpio none' +_am_tools=${am_cv_prog_tar_ustar-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +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); } + 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; } + + + + + +# 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_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=10 + +COGL_1_MICRO_VERSION=2 + +COGL_1_VERSION=1.10.2 + + + +COGL_LT_CURRENT=10 + +COGL_LT_REVISION=1 + +COGL_LT_AGE=1 + +COGL_LT_RELEASE=2.0.0 + + + +COGL_RELEASE_STATUS=release + + + +# 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 + + +{ $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 + + +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='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +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 +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +#include +#include +/* 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 + +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'. + 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 8's {/usr,}/bin/sh. + touch 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 + ;; + 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 + + + +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" + { test -f "$ac_path_GREP" && $as_test_x "$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" + { test -f "$ac_path_EGREP" && $as_test_x "$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" "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-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_HANDLE_DEBUG -DCOGL_ENABLE_DEBUG" + ;; #( + no) : + + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_ENABLE_DEBUG -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" + ;; #( + *) : + as_fn_error $? "Unknown argument for --enable-debug" "$LINENO" 5 + ;; +esac + + + + + + + + + + + +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 + -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#* }" + +# Check whether --enable-gdk-pixbuf was given. +if test "${enable_gdk_pixbuf+set}" = set; then : + enableval=$enable_gdk_pixbuf; +else + enable_gdk_pixbuf=yes + +fi + +if test "x$enable_gdk_pixbuf" = "xyes"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gdk-pixbuf-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gdk-pixbuf-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + have_gdk_pixbuf=yes +else + have_gdk_pixbuf=no +fi +else + have_gdk_pixbuf=no +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$have_gdk_pixbuf" = "xyes"; then : + + +$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_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-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 + BUILD_COGL_PANGO_TRUE= + BUILD_COGL_PANGO_FALSE='#' +else + BUILD_COGL_PANGO_TRUE='#' + BUILD_COGL_PANGO_FALSE= +fi + + +if test "x$enable_cogl_pango" = "xyes"; then : + + COGL_PANGO_PKG_REQUIRES="$COGL_PANGO_PKG_REQUIRES pangocairo >= 1.20" + + +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 + + +# Check whether --enable-glib was given. +if test "${enable_glib+set}" = set; then : + enableval=$enable_glib; +else + enable_glib=yes + +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" + +else + + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib," + + +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" + NEED_EGL=yes + +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 -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 + + NEED_EGL=yes + +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 + + + + + + + + + +if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then + +$as_echo "#define HAVE_DIRECTLY_LINKED_GL_LIBRARY 1" >>confdefs.h + +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" + + # We might fall back to DRM for sync-to-vblank on GLX + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libdrm") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + + +$as_echo "#define HAVE_DRM 1" >>confdefs.h + + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES libdrm" + +fi + +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 + + +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" + + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wayland-egl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wayland-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 wayland-egl" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-client" + +else + as_fn_error $? "Unable to locate required wayland libraries" "$LINENO" 5 +fi + + 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 kms libraries" "$LINENO" 5 +fi + + 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 + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-server" + 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 $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 + + +# 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 -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 + : +else + as_fn_error $? "SDL support requested but SDL not found" "$LINENO" 5 +fi + + SUPPORT_SDL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS sdl" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES sdl" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_SUPPORT" + +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 + + +if test "x$NEED_XLIB" = "xyes"; then : + + X11_MODULES="x11 xext xfixes >= 3 xdamage xcomposite >= 0.4" + +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` +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` +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 "$X11_MODULES" 2>&1` + else + DUMMY_PKG_ERRORS=`$PKG_CONFIG --print-errors "$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 + + + +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +#include +#include +/* 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 + +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'. + 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 8's {/usr,}/bin/sh. + touch 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 + ;; + 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 + + +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 + +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $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; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_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. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { 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; } && + test -f conftest2.$ac_objext && { { 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 + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&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_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { 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; } && + test -f conftest2.$ac_objext && { { 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 + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; 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; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != 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 + + +{ $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 () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* 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. */ + char *t; + 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 saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; 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 + + + + +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' +macro_revision='1.3293' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# 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" + { test -f "$ac_path_SED" && $as_test_x "$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" + { test -f "$ac_path_FGREP" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 + ;; + + 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"`func_fallback_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 Linux 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$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};"\ +" /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 + ;; +sparc*-*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*) LD="${LD-ld} -m elf64_sparc" ;; + *) + 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 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 -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; 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 + + + + + +# 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; pic_mode="$withval" +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 ' + lt_prog_compiler_pic='-Xcompiler -fPIC' + ;; + 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\ F* | *Sun*Fortran*) + # 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\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + 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_flag_spec_ld= + 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= + hardcode_libdir_flag_spec_ld='-rpath $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 + 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 + ;; + + freebsd1*) + ld_shlibs=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_flag_spec_ld='+b $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 + 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 + 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 + 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 + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +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[123]*) 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 + 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 + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux + 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 + 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 + 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 Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + 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 + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # 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="$sys_lib_dlsearch_path_spec $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 + 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 + 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 + 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 + 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 + 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 + 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" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + + + + { $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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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; } + + + +# 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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` +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` +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 "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` + else + GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors "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 + + as_fn_error $? "Package requirements (glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0) were not met: + +$GTKDOC_DEPS_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 GTKDOC_DEPS_CFLAGS +and GTKDOC_DEPS_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 GTKDOC_DEPS_CFLAGS +and GTKDOC_DEPS_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 + 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 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 + + + +# 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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.28.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; + char *tmp_version; + + fclose (fopen ("conf.glibtest", "w")); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_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 + +if test "x$have_glib" = "xno"; then : + as_fn_error $? "gobject-2.0 is required" "$LINENO" 5 +fi + +COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0" + + +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` +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` +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 "$COGL_PKG_REQUIRES" 2>&1` + else + COGL_DEP_PKG_ERRORS=`$PKG_CONFIG --print-errors "$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` +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` +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 "$COGL_PKG_REQUIRES_GL" 2>&1` + else + COGL_DEP_GL_PKG_ERRORS=`$PKG_CONFIG --print-errors "$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 + + +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` +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` +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 "$COGL_PANGO_PKG_REQUIRES" 2>&1` + else + COGL_PANGO_DEP_PKG_ERRORS=`$PKG_CONFIG --print-errors "$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 + + + + + + + # 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 + ;; #( + *) : + 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 + + + + +{ $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 + + + + +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 + + + +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 + + +else + + 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 cogl/Makefile cogl/cogl-1.0.pc cogl/cogl-2.0-experimental.pc cogl/cogl-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 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 examples/Makefile tests/Makefile tests/conform/Makefile tests/conform/config.env tests/conform/test-launcher.sh 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 + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +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 "${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 -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 "${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 "${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 "${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 "${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 "${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 "${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_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 "${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 "${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 "${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 -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 "${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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +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 + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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.10.2, which was +generated by GNU Autoconf 2.68. 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.10.2 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 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"`' +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_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $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"`' + +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 \ +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_flag_spec_ld \ +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; 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; 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' + + + +# 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" ;; + "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" ;; + "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.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" ;; + "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" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/conform/Makefile") CONFIG_FILES="$CONFIG_FILES tests/conform/Makefile" ;; + "tests/conform/config.env") CONFIG_FILES="$CONFIG_FILES tests/conform/config.env" ;; + "tests/conform/test-launcher.sh") CONFIG_FILES="$CONFIG_FILES tests/conform/test-launcher.sh" ;; + "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"" || { + # Autoconf 2.62 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"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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 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="" + +# ### 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 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 + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# 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 + +# ### 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" + + ;; + "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}" + +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 +echo " Image backend: ${COGL_IMAGE_BACKEND}" +echo " Cogl Pango: ${enable_cogl_pango}" +echo " Profiling: ${enable_profile}" + +# Compiler/Debug related flags +echo "" +echo " • Compiler options:" +echo " Cogl debug: ${enable_debug}" +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 "" + +# 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..7b67457 --- /dev/null +++ b/configure.ac @@ -0,0 +1,1201 @@ +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], [10]) +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], 10) +m4_define([cogl_lt_revision], 1) +m4_define([cogl_lt_age], 1) +# 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. +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) + +dnl ================================================================ +dnl Required versions for dependencies +dnl ================================================================ +m4_define([glib_req_version], [2.28.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([cairo_req_version], [1.10]) + +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]) + +# 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-bzip2 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 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 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_HANDLE_DEBUG -DCOGL_ENABLE_DEBUG" + ], + [no], + [ + COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_ENABLE_DEBUG -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" + ], + [AC_MSG_ERROR([Unknown argument for --enable-debug])] +) + +AC_SUBST(COGL_DEBUG_CFLAGS) + + +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 + -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 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@:>@])], + [], + enable_gdk_pixbuf=yes +) +if test "x$enable_gdk_pixbuf" = "xyes"; then + PKG_CHECK_EXISTS([gdk-pixbuf-2.0], [have_gdk_pixbuf=yes], [have_gdk_pixbuf=no]) +else + have_gdk_pixbuf=no +fi + +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$have_gdk_pixbuf" = "xyes"], + [ + 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_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 cogl-pango be built? +dnl ============================================================ + +AC_ARG_ENABLE( + [cogl-pango], + [AC_HELP_STRING([--enable-cogl-pango=@<:@no/yes@:>@], [Enable pango support @<:@default=yes@:>@])], + [], + enable_cogl_pango=yes +) +AM_CONDITIONAL([BUILD_COGL_PANGO], [test "x$enable_cogl_pango" = "xyes"]) + +AS_IF([test "x$enable_cogl_pango" = "xyes"], + [ + COGL_PANGO_PKG_REQUIRES="$COGL_PANGO_PKG_REQUIRES pangocairo >= pangocairo_req_version" + ] +) + +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 Should glib be used? +dnl ============================================================ +AC_ARG_ENABLE( + [glib], + [AC_HELP_STRING([--enable-glib=@<:@no/yes@:>@], [Enable glib support @<:@default=yes@:>@])], + [], + enable_glib=yes +) +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" + ], + [ + EXPERIMENTAL_CONFIG=yes + EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib," + ] +) + +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" + NEED_EGL=yes + ], + [ + # 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 + + 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" + ]) + + NEED_EGL=yes + ]) + +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 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_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]) + +if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then + AC_DEFINE([HAVE_DIRECTLY_LINKED_GL_LIBRARY], [1], + [Defined if the GL library shouldn't be dlopened]) +fi + +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" + + # We might fall back to DRM for sync-to-vblank on GLX + PKG_CHECK_EXISTS([libdrm], + [ + AC_DEFINE([HAVE_DRM], [1], [Have libdrm support]) + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES libdrm" + ], + []) + ]) +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"]) + +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_EXISTS([wayland-egl], + [ + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-egl" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-client" + ], + [AC_MSG_ERROR([Unable to locate required wayland libraries])]) + + 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 kms libraries])]) + + 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 + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES wayland-server" + 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 $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"]) + +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"], + [ + PKG_CHECK_EXISTS([sdl], + [], + [AC_MSG_ERROR([SDL support requested but SDL not found])]) + + SUPPORT_SDL=yes + GL_WINSYS_APIS="$GL_WINSYS_APIS sdl" + COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES sdl" + + COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_SDL_SUPPORT" + ], + [SUPPORT_SDL=no]) +AM_CONDITIONAL(SUPPORT_SDL, [test "x$SUPPORT_SDL" = "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" + 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 Compiler stuff. +dnl ================================================================ +AC_PROG_CC +AC_PROG_CPP +AM_PROG_CC_C_O +AC_ISC_POSIX +AC_C_CONST + + +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 ================================================================ +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 + + +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"]) + +dnl ================================================================ +dnl Check for dependency packages. +dnl ================================================================ + +dnl ============================================================ +dnl Check glib dependencies +dnl ============================================================ +AM_PATH_GLIB_2_0([glib_req_version], + [have_glib=yes], [have_glib=no], + [gobject gthread gmodule-no-export]) +AS_IF([test "x$have_glib" = "xno"], AC_MSG_ERROR([gobject-2.0 is required])) + +COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0" +AC_SUBST(COGL_PKG_REQUIRES) +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 +AC_SUBST(COGL_PANGO_PKG_REQUIRES) + +AS_IF([test "x$enable_cogl_pango" = "xyes"], + [PKG_CHECK_MODULES(COGL_PANGO_DEP, [$COGL_PANGO_PKG_REQUIRES])] +) + +dnl ================================================================ +dnl Misc program dependencies. +dnl ================================================================ +AC_PROG_INSTALL + +dnl ================================================================ +dnl GObject-Introspection check +dnl ================================================================ +GOBJECT_INTROSPECTION_CHECK([gi_req_version]) + +dnl ================================================================ +dnl Checks for header files. +dnl ================================================================ +AC_PATH_X +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h limits.h unistd.h) + + +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. +AC_CHECK_FUNCS([ffs]) + +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 +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_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) + + +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) + +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_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 +cogl/Makefile +cogl/cogl-1.0.pc +cogl/cogl-2.0-experimental.pc +cogl/cogl-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 +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 +examples/Makefile +tests/Makefile +tests/conform/Makefile +tests/conform/config.env +tests/conform/test-launcher.sh +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}" + +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 +echo " Image backend: ${COGL_IMAGE_BACKEND}" +echo " Cogl Pango: ${enable_cogl_pango}" +echo " Profiling: ${enable_profile}" + +# Compiler/Debug related flags +echo "" +echo " • Compiler options:" +echo " Cogl debug: ${enable_debug}" +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 "" + +# 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/doc/CODING_STYLE b/doc/CODING_STYLE new file mode 100644 index 0000000..748b915 --- /dev/null +++ b/doc/CODING_STYLE @@ -0,0 +1,49 @@ +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 follow the "+ Functions" section of the +Clutter CODING_STYLE like: + +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 types. + +The following types should not be used: + gint, guint, gfloat, gdouble, glong, gulong, gchar and guchar +Instead use: + int, unsigned int, float, double, long, unsigned long, char, and + guint8/unsigned char + +The glib types that we continue to use for portability are gboolean, +gint{8,16,32,64}, guint{8,16,32,64} and gsize. When ever you need a +byte size type for dealing with pixel data then guint8 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..39f00b1 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,669 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive 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-recursive \ + 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..8cf6d05 --- /dev/null +++ b/doc/reference/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = cogl cogl-2.0-experimental diff --git a/doc/reference/Makefile.in b/doc/reference/Makefile.in new file mode 100644 index 0000000..190e07b --- /dev/null +++ b/doc/reference/Makefile.in @@ -0,0 +1,667 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = doc/reference +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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 +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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive 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-recursive \ + 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..df29aaf --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/Makefile.am @@ -0,0 +1,159 @@ +## 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=$(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 \ + $(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 +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-array-private.h \ + cogl-indices-private.h \ + cogl-journal-private.h \ + cogl-material-compat.h \ + cogl-matrix-private.h \ + cogl-object-private.h \ + cogl-path.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-array-private.h \ + cogl-primitive-private.h \ + cogl-primitives-private.h \ + cogl-private.h \ + cogl-program-private.h \ + cogl-program.h \ + cogl-shader-private.h \ + cogl-shader.h \ + cogl-snippet-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-buffer.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-handle.h \ + cogl-internal.h \ + cogl-matrix-mesa.h \ + cogl-matrix-stack.h \ + cogl-spans.h \ + cogl-profile.h \ + cogl-util.h \ + driver \ + tesselator + +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-2.0-experimental/Makefile.in b/doc/reference/cogl-2.0-experimental/Makefile.in new file mode 100644 index 0000000..2db893f --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/Makefile.in @@ -0,0 +1,877 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/cogl-2.0-experimental-docs.xml.in \ + $(top_srcdir)/gtk-doc.make +subdir = doc/reference/cogl-2.0-experimental +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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=$(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 \ + $(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 +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-array-private.h \ + cogl-indices-private.h \ + cogl-journal-private.h \ + cogl-material-compat.h \ + cogl-matrix-private.h \ + cogl-object-private.h \ + cogl-path.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-array-private.h \ + cogl-primitive-private.h \ + cogl-primitives-private.h \ + cogl-private.h \ + cogl-program-private.h \ + cogl-program.h \ + cogl-shader-private.h \ + cogl-shader.h \ + cogl-snippet-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-buffer.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-handle.h \ + cogl-internal.h \ + cogl-matrix-mesa.h \ + cogl-matrix-stack.h \ + cogl-spans.h \ + cogl-profile.h \ + cogl-util.h \ + driver \ + tesselator + +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 +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_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 +TAGS: + +ctags: CTAGS +CTAGS: + +@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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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@uninstall-local: +@BUILD_GTK_DOC_FALSE@distclean-local: +@BUILD_GTK_DOC_FALSE@install-data-local: +@BUILD_GTK_DOC_FALSE@maintainer-clean-local: +@BUILD_GTK_DOC_FALSE@clean-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 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 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 + +#### setup #### + +@BUILD_GTK_DOC_TRUE@setup-build.stamp: +@BUILD_GTK_DOC_TRUE@ -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ echo ' DOC Preparing build'; \ +@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)/ || true; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ @touch setup-build.stamp + +#### scan #### + +@BUILD_GTK_DOC_TRUE@scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) +@BUILD_GTK_DOC_TRUE@ @echo ' DOC Scanning header files' +@BUILD_GTK_DOC_TRUE@ @_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@ @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ +@BUILD_GTK_DOC_TRUE@ echo " DOC Introspecting gobjects"; \ +@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@ @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 + +#### xml #### + +@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@ @echo ' DOC Building XML' +@BUILD_GTK_DOC_TRUE@ @_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@ @touch sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@sgml.stamp: sgml-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +#### html #### + +@BUILD_GTK_DOC_TRUE@html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ @echo ' DOC Building HTML' +@BUILD_GTK_DOC_TRUE@ @rm -rf html +@BUILD_GTK_DOC_TRUE@ @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@ @echo ' DOC Fixing cross-references' +@BUILD_GTK_DOC_TRUE@ @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ @touch html-build.stamp + +#### pdf #### + +@BUILD_GTK_DOC_TRUE@pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ @echo ' DOC Building PDF' +@BUILD_GTK_DOC_TRUE@ @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@ @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: clean +@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: +@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..99b0bdb --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml @@ -0,0 +1,203 @@ + + +]> + + + + Cogl 2.0 Reference Manual + for Cogl 2.0; + + + 2008 + OpenedHand LTD + + + + 2009 + 2010 + 2011 + 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. + +
+ + + + + +
+ Setting Up A GPU Pipeline + + + +
+ +
+ Allocating GPU Memory + + + +
+ +
+ Describing the layout of GPU Memory + + +
+ +
+ Geometry + + + +
+ +
+ Textures + + + + +
+ +
+ Meta 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..3f49e62 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml.in @@ -0,0 +1,203 @@ + + +]> + + + + Cogl 2.0 Reference Manual + for Cogl 2.0; + + + 2008 + OpenedHand LTD + + + + 2009 + 2010 + 2011 + 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. + +
+ + + + + +
+ Setting Up A GPU Pipeline + + + +
+ +
+ Allocating GPU Memory + + + +
+ +
+ Describing the layout of GPU Memory + + +
+ +
+ Geometry + + + +
+ +
+ Textures + + + + +
+ +
+ Meta 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..ca3340d --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt @@ -0,0 +1,768 @@ + +
+cogl-object +The Object Interface +CoglObject +cogl_object_ref +cogl_object_unref +CoglUserDataKey +cogl_object_get_user_data +cogl_object_set_user_data +
+ +
+cogl-renderer +CoglRenderer: Connect to a backend renderer +cogl_renderer_new +cogl_renderer_get_n_fragment_texture_units +cogl_renderer_connect + + +cogl_xlib_renderer_set_foreign_display +cogl_xlib_renderer_get_foreign_display + + +CoglXlibFilterFunc +cogl_xlib_renderer_add_native_filter +cogl_xlib_renderer_remove_native_filter +cogl_xlib_renderer_handle_native_event + + +CoglWin32FilterFunc +cogl_win32_renderer_add_native_filter +cogl_win32_renderer_remove_native_filter +cogl_win32_renderer_handle_native_event + + +cogl_wayland_renderer_set_foreign_display +cogl_wayland_renderer_get_display +cogl_wayland_renderer_set_foreign_compositor +cogl_wayland_renderer_get_compositor +
+ +
+cogl-swap-chain +CoglSwapChain: Describe a set of back buffers for flipping between +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 +cogl_onscreen_template_new +
+ +
+cogl-display +CoglDisplay: Setup a display pipeline +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 + + +cogl_context_new +cogl_is_context +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 integeration +CoglPollFDEvent +CoglPollFD +cogl_poll_get_info +cogl_poll_dispatch +cogl_glib_source_new +
+ +
+cogl-index-array +Index Arrays +cogl_index_array_new +cogl_is_index_array +
+ +
+cogl-attribute +Vertex Attributes +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 +cogl_indices_new +cogl_is_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-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 +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_path_fill +cogl_path_stroke +
+ +
+cogl-texture +The Texture Interface +CoglTexture +cogl_is_texture + + +cogl_texture_get_width +cogl_texture_get_height +cogl_texture_get_format +cogl_texture_is_sliced +cogl_texture_get_data +cogl_texture_set_region +CoglTextureType + + +COGL_TEXTURE_MAX_WASTE +
+ +
+cogl-texture-2d +2D textures +CoglTexture2D +cogl_texture_2d_new_with_size +cogl_texture_2d_new_from_data +cogl_texture_2d_new_from_foreign +cogl_is_texture_rectangle +
+ +
+cogl-texture-rectangle +Rectangle textures (non-normalized coordinates) +CoglTextureRectangle +cogl_texture_rectangle_new_with_size +cogl_is_texture_rectangle +
+ +
+cogl-texture-3d +3D textures +CoglTexture3D +cogl_texture_3d_new_with_size +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-sub-texture +Sub Textures +CoglSubTexture +cogl_sub_texture_new +cogl_is_sub_texture +
+ +
+cogl-texture-2d-sliced +Sliced Textures +CoglTexture2DSliced +cogl_texture_2d_sliced_new_with_size +cogl_is_texture_2d_sliced +
+ +
+cogl-texture-pixmap-x11 +X11 Texture From Pixmap +cogl_texture_pixmap_x11_new +cogl_texture_pixmap_x11_update_area +cogl_texture_pixmap_x11_is_using_tfp_extension +cogl_texture_pixmap_x11_set_damage_object +cogl_is_texture_pixmap_x11 +
+ +
+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_color_format +cogl_framebuffer_get_red_bits +cogl_framebuffer_get_green_bits +cogl_framebuffer_get_blue_bits +cogl_framebuffer_get_blue_bits +cogl_framebuffer_get_color_mask +cogl_framebuffer_set_color_mask +cogl_framebuffer_get_point_samples_per_pixel +cogl_framebuffer_set_point_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_primitive +cogl_framebuffer_draw_attributes +cogl_framebuffer_vdraw_attributes +cogl_framebuffer_draw_indexed_attributes +cogl_framebuffer_vdraw_indexed_attributes +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_swap_buffers +cogl_framebuffer_swap_region +cogl_framebuffer_add_swap_buffers_callback +cogl_framebuffer_remove_swap_buffers_callback +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_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_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_ONSCREEN +cogl_onscreen_new +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_set_swap_throttled +cogl_onscreen_show +cogl_onscreen_hide +
+ +
+cogl-offscreen +Offscreen Framebuffers +cogl_offscreen_new_to_texture +cogl_is_offscreen +
+ +
+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-matrix +Matrices +CoglMatrix +cogl_matrix_init_identity +cogl_matrix_init_from_array +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_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-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 +
+ +
+cogl-pipeline +Pipeline +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 + +CoglMaterialAlphaFunc +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_get_color_mask +cogl_pipeline_set_color_mask + +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 +CoglMaterialFilter +cogl_pipeline_set_layer_filters +cogl_pipeline_get_layer_min_filter +cogl_pipeline_get_layer_mag_filter +CoglMaterialWrapMode +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 +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_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 +CoglBuffer: The Buffer Interface +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-attribute-buffer +CoglAttributeBuffer: Buffers of vertex attributes +CoglAttributeBuffer +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-types +Common Types +CoglFuncPtr +CoglPixelFormat +CoglBufferTarget +CoglBufferBit +CoglAttributeType +CoglColorMask +
+ +
+cogl-gtype +GType Integration API +cogl_gtype_matrix_get_type +
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 0000000..2c2a1fd Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/cogl_ortho.png differ 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 0000000..1e4fbb0 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/fill-rule-even-odd.png differ 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 0000000..2d8ad31 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/fill-rule-non-zero.png differ diff --git a/doc/reference/cogl-2.0-experimental/html/ch01.html b/doc/reference/cogl-2.0-experimental/html/ch01.html new file mode 100644 index 0000000..7831e61 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ch01.html @@ -0,0 +1,176 @@ + + + + +Cogl - a modern 3D graphics API + + + + + + + + + + + + + + + + +
+

+Cogl - a modern 3D graphics API

+
+
About Cogl
+
+The Object Interface +
+
+The Top-Level Context — The top level application context. +
+
+Main loop integeration — Functions for integrating Cogl with an + application's main loop +
+
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 +
+
+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 +
+
+Indices +
+
+
Geometry
+
+
+Primitives — Functions for creating, manipulating and drawing + primitives +
+
+Path Primitives — Functions for constructing and drawing 2D paths. +
+
+Rectangles +
+
+
Textures
+
+
+The Texture Interface — Fuctions for creating and manipulating textures +
+
+2D textures — Functions for creating and manipulating 2D textures +
+
+3D textures — Fuctions for creating and manipulating 3D textures +
+
+Rectangle textures (non-normalized coordinates) — Functions for creating and manipulating rectangle + textures for use with non-normalized coordinates. +
+
+
Meta Textures
+
+
+High Level Meta Textures — Interface 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. +
+
+
Framebuffers
+
+
+CoglFramebuffer: The Framebuffer Interface — A common interface for manipulating framebuffers +
+
+Offscreen Framebuffers — Fuctions for creating and manipulating offscreen + framebuffers. +
+
+
Utilities
+
+
+Color Type — A generic color definition +
+
+Matrices — Fuctions for initializing and manipulating 4x4 matrices +
+
+3 Component Vectors — Functions for handling single precision float + vectors. +
+
+Quaternions (Rotations) — Functions for initializing and manipulating +quaternions. +
+
+Common Types +
+
+
Binding and Integrating
+
+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.

+
+<xi:include></xi:include> +
+ + + \ 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..69925cc --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-2D-textures.html @@ -0,0 +1,290 @@ + + + + +2D textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

2D textures

+

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

+
+ +
+

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

+
#define cogl_texture_2d_new_with_size cogl_texture_2d_new_with_size_EXP
+
+

+Allocates a low-level CoglTexture2D texture that your GPU can +texture from directly. This is unlike sliced textures for example +which may be comprised of multiple internal textures, or atlas +textures where Cogl has to modify texture coordinates before they +may be used by the GPU. +

+

+

+
+

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

internal_format :

The format of the texture

error :

A GError 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.
+

Since 2.0

+
+
+
+

cogl_texture_2d_new_from_data

+
#define cogl_texture_2d_new_from_data cogl_texture_2d_new_from_data_EXP
+
+

+Creates a new CoglTexture2D texture based on data residing in memory. +These are unlike sliced textures for example which may be comprised +of multiple internal textures, or atlas textures where Cogl has to +modify texture coordinates before they may be used by the GPU. +

+

+

+
+

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

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. 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 GError 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.
+

Since 2.0

+
+
+
+

cogl_texture_2d_new_from_foreign

+
#define cogl_texture_2d_new_from_foreign cogl_texture_2d_new_from_foreign_EXP
+
+

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

+

+

+
+

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

internal_format :

The format of the texture

error :

A GError for exceptions

Returns :

A newly allocated CoglTexture2D, or if Cogl could not +validate the gl_handle in some way (perhaps because of +an unsupported format) it will return NULL and set +error.
+

Since 2.0

+
+
+
+

cogl_is_texture_rectangle

+
#define cogl_is_texture_rectangle cogl_is_texture_rectangle_EXP
+
+

+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..d73c6ab --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3-Component-Vectors.html @@ -0,0 +1,602 @@ + + + + +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);
+gboolean            cogl_vector3_equal                  (gconstpointer v1,
+                                                         gconstpointer v2);
+gboolean            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 ()

+
gboolean            cogl_vector3_equal                  (gconstpointer v1,
+                                                         gconstpointer 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 ()

+
gboolean            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
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_vector_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. +

+
++ + + + +

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
(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
|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..19acdb3 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-3D-textures.html @@ -0,0 +1,255 @@ + + + + +3D textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

3D textures

+

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

+
+
+

Synopsis

+
                    CoglTexture3D;
+CoglTexture3D *     cogl_texture_3d_new_with_size       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat internal_format,
+                                                         GError **error);
+CoglTexture3D *     cogl_texture_3d_new_from_data       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat format,
+                                                         CoglPixelFormat internal_format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const guint8 *data,
+                                                         GError **error);
+gboolean            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,
+                                                         CoglPixelFormat internal_format,
+                                                         GError **error);
+

+Creates a new Cogl 3D texture with the specified dimensions and +pixel format. +

+

+Note that this function will throw a GError if +COGL_FEATURE_TEXTURE_3D is not advertised. It 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.

internal_format :

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

error :

A GError return location.

Returns :

a new CoglTexture3D object or +NULL on failure and an exception will be returned +in error.
+

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,
+                                                         CoglPixelFormat internal_format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const guint8 *data,
+                                                         GError **error);
+

+Creates a new 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 that this function will throw a GError if +COGL_FEATURE_TEXTURE_3D is not advertised. It 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.

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 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 GError return location.

Returns :

the newly created CoglTexture3D or NULL if +there was an error an an exception will be returned +through error.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_texture_3d ()

+
gboolean            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-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..b89f79a --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglAttributeBuffer---Buffers-of-vertex-attributes.html @@ -0,0 +1,131 @@ + + + + +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         (CoglContext *context,
+                                                         gsize bytes,
+                                                         const void *data);
+gboolean            cogl_is_attribute_buffer            (void *object);
+
+
+
+

Description

+

+FIXME +

+
+
+

Details

+
+

CoglAttributeBuffer

+
typedef struct {
+  CoglBuffer _parent;
+} CoglAttributeBuffer;
+
+
+
+
+

cogl_attribute_buffer_new ()

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

+Declares a new CoglAttributeBuffer of size bytes to contain arrays of vertex +attribute data. 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 +

bytes :

The number of bytes to allocate for vertex attribute data.

data :

An optional pointer to vertex data to upload immediately.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_is_attribute_buffer ()

+
gboolean            cogl_is_attribute_buffer            (void *object);
+

+Gets whether the given object references a CoglAttributeBuffer. +

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

object :

A CoglObject +

Returns :

+TRUE if the handle 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..f002d60 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglBuffer---The-Buffer-Interface.html @@ -0,0 +1,430 @@ + + + + +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

+
gboolean            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);
+gboolean            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         gsize offset,
+                                                         const void *data,
+                                                         gsize size);
+
+#define             cogl_pixel_buffer_new
+#define             cogl_is_pixel_buffer
+
+
+
+

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 ()

+
gboolean            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. +

+

+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
+

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 ()

+
gboolean            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         gsize offset,
+                                                         const void *data,
+                                                         gsize 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

+
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
+
+

+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
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_pixel_buffer

+
#define cogl_is_pixel_buffer cogl_is_pixel_buffer_EXP
+
+

+Checks whether handle is a pixel array. +

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

object :

a CoglObject to test

Returns :

+TRUE if the handle is a pixel array, 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-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..f2b80f8 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglFramebuffer---The-Framebuffer-Interface.html @@ -0,0 +1,2862 @@ + + + + +CoglFramebuffer: The Framebuffer Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

CoglFramebuffer: The Framebuffer Interface

+

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

+
+
+

Synopsis

+
                    CoglFramebuffer;
+#define             COGL_FRAMEBUFFER                    (X)
+gboolean            cogl_framebuffer_allocate           (CoglFramebuffer *framebuffer,
+                                                         GError **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);
+CoglPixelFormat     cogl_framebuffer_get_color_format   (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_red_bits       (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_green_bits     (CoglFramebuffer *framebuffer);
+int                 cogl_framebuffer_get_blue_bits      (CoglFramebuffer *framebuffer);
+CoglColorMask       cogl_framebuffer_get_color_mask     (CoglFramebuffer *framebuffer);
+void                cogl_framebuffer_set_color_mask     (CoglFramebuffer *framebuffer,
+                                                         CoglColorMask color_mask);
+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);
+gboolean            cogl_framebuffer_read_pixels_into_bitmap
+                                                        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         CoglReadPixelsFlags source,
+                                                         CoglBitmap *bitmap);
+gboolean            cogl_framebuffer_read_pixels        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         guint8 *pixels);
+void                cogl_framebuffer_set_dither_enabled (CoglFramebuffer *framebuffer,
+                                                         gboolean dither_enabled);
+gboolean            cogl_framebuffer_get_dither_enabled (CoglFramebuffer *framebuffer);
+
+void                cogl_framebuffer_draw_primitive     (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglPrimitive *primitive);
+void                cogl_framebuffer_draw_attributes    (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglVerticesMode mode,
+                                                         int first_vertex,
+                                                         int n_vertices,
+                                                         CoglAttribute **attributes,
+                                                         int n_attributes);
+void                cogl_framebuffer_vdraw_attributes   (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglVerticesMode mode,
+                                                         int first_vertex,
+                                                         int n_vertices,
+                                                         ...);
+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);
+void                cogl_framebuffer_vdraw_indexed_attributes
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglVerticesMode mode,
+                                                         int first_vertex,
+                                                         int n_vertices,
+                                                         CoglIndices *indices,
+                                                         ...);
+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 *verts,
+                                                         unsigned int n_rects);
+void                cogl_framebuffer_draw_textured_rectangles
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         const float *coordinates,
+                                                         unsigned int n_rectangles);
+
+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_transform          (CoglFramebuffer *framebuffer,
+                                                         const CoglMatrix *matrix);
+void                cogl_framebuffer_get_modelview_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglMatrix *matrix);
+void                cogl_framebuffer_set_modelview_matrix
+                                                        (CoglFramebuffer *framebuffer,
+                                                         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,
+                                                         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_to_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 struct _CoglFramebuffer CoglFramebuffer;
+
+
+
+

COGL_FRAMEBUFFER()

+
#define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X))
+
+
+
+
+

cogl_framebuffer_allocate ()

+
gboolean            cogl_framebuffer_allocate           (CoglFramebuffer *framebuffer,
+                                                         GError **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 GError 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.
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_get_color_format ()

+
CoglPixelFormat     cogl_framebuffer_get_color_format   (CoglFramebuffer *framebuffer);
+

+Queries the common CoglPixelFormat of all color buffers attached +to this framebuffer. For an offscreen framebuffer created with +cogl_offscreen_new_to_texture() this will correspond to the format +of the texture. +

+
++ + + + +

framebuffer :

A CoglFramebuffer framebuffer
+

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_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_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);
+
+
+
+

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 ()

+
gboolean            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 ()

+
gboolean            cogl_framebuffer_read_pixels        (CoglFramebuffer *framebuffer,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height,
+                                                         CoglPixelFormat format,
+                                                         guint8 *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
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,
+                                                         gboolean 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 ()

+
gboolean            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_primitive ()

+
void                cogl_framebuffer_draw_primitive     (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglPrimitive *primitive);
+

+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. +

+

+

+
+

Note

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() +
+

+

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

framebuffer :

A destination CoglFramebuffer +

pipeline :

A CoglPipeline state object

primitive :

A CoglPrimitive geometry object
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_draw_attributes ()

+
void                cogl_framebuffer_draw_attributes    (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglVerticesMode mode,
+                                                         int first_vertex,
+                                                         int n_vertices,
+                                                         CoglAttribute **attributes,
+                                                         int n_attributes);
+

+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. +

+

+

+
+

Note

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() +
+

+

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

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.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_vdraw_attributes ()

+
void                cogl_framebuffer_vdraw_attributes   (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglVerticesMode mode,
+                                                         int first_vertex,
+                                                         int n_vertices,
+                                                         ...);
+

+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. +

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

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
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_draw_indexed_attributes ()

+
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);
+

+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. +

+

+

+
+

Note

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. +

+

+

+
+

Note

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() +
+

+

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

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.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_framebuffer_vdraw_indexed_attributes ()

+
void                cogl_framebuffer_vdraw_indexed_attributes
+                                                        (CoglFramebuffer *framebuffer,
+                                                         CoglPipeline *pipeline,
+                                                         CoglVerticesMode mode,
+                                                         int first_vertex,
+                                                         int n_vertices,
+                                                         CoglIndices *indices,
+                                                         ...);
+

+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. +

+

+

+
+

Note

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. +

+

+

+
+

Note

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() +
+

+

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

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
+

Since 1.10

+

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_framebuffer_draw_primitive() or +cogl_framebuffer_draw_attributes() 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_framebuffer_draw_primitive() or +cogl_framebuffer_draw_attributes() 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 *verts,
+                                                         unsigned int n_rects);
+

+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_framebuffer_draw_primitive() or +cogl_framebuffer_draw_attributes() 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_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 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. +

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

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_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,
+                                                         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,
+                                                         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 top-left corner of the primitives +bounds

bounds_y2 :

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

bounds_x1 :

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_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 +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_set_framebuffer ()

+
void                cogl_set_framebuffer                (CoglFramebuffer *buffer);
+

+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);
+

+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
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);
+

+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..f670651 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-CoglIndexBuffer---Buffers-of-vertex-indices.html @@ -0,0 +1,122 @@ + + + + +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,
+                                                         gsize bytes);
+gboolean            cogl_is_index_buffer                (void *object);
+
+
+
+

Description

+

+FIXME +

+
+
+

Details

+
+

CoglIndexBuffer

+
typedef struct {
+  CoglBuffer _parent;
+} CoglIndexBuffer;
+
+
+
+
+

cogl_index_buffer_new ()

+
CoglIndexBuffer *   cogl_index_buffer_new               (CoglContext *context,
+                                                         gsize 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.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_is_index_buffer ()

+
gboolean            cogl_is_index_buffer                (void *object);
+

+Gets whether the given object references a CoglIndexBuffer. +

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

object :

A CoglObject +

Returns :

+TRUE if the handle 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-Color-Type.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Color-Type.html new file mode 100644 index 0000000..65c3942 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Color-Type.html @@ -0,0 +1,916 @@ + + + + +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,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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);
+gboolean            cogl_color_equal                    (gconstpointer v1,
+                                                         gconstpointer v2);
+
+
+
+

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,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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 ()

+
gboolean            cogl_color_equal                    (gconstpointer v1,
+                                                         gconstpointer 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

+
+
+
+ + + \ 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..881ae04 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Common-Types.html @@ -0,0 +1,438 @@ + + + + +Common Types + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Common Types

+

Common Types

+
+
+

Synopsis

+
void                (*CoglFuncPtr)                      (void);
+enum                CoglPixelFormat;
+enum                CoglBufferTarget;
+enum                CoglBufferBit;
+enum                CoglAttributeType;
+enum                CoglColorMask;
+
+
+
+

Description

+
+
+

Details

+
+

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_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)
+} 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_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 +
+

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 +
+
+
+
+ + + \ 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..b76dc21 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-GType-Integration-API.html @@ -0,0 +1,67 @@ + + + + +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);
+
++ + + + +

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..01b605f --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-High-Level-Meta-Textures.html @@ -0,0 +1,270 @@ + + + + +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

+
                    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_draw_attributes() 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_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_draw_attributes(). +

+

+

+
+

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 struct _CoglMetaTexture 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_draw_attributes() +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..3f3132d --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Indices.html @@ -0,0 +1,90 @@ + + + + +Indices + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Indices

+

Indices

+
+
+

Synopsis

+
CoglIndices *       cogl_indices_new                    (CoglContext *context,
+                                                         CoglIndicesType type,
+                                                         const void *indices_data,
+                                                         int n_indices);
+gboolean            cogl_is_indices                     (void *object);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_indices_new ()

+
CoglIndices *       cogl_indices_new                    (CoglContext *context,
+                                                         CoglIndicesType type,
+                                                         const void *indices_data,
+                                                         int n_indices);
+
+
+
+

cogl_is_indices ()

+
gboolean            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

+
+
+
+ + + \ No newline at end of file diff --git a/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Main-loop-integeration.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Main-loop-integeration.html new file mode 100644 index 0000000..0c963a3 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Main-loop-integeration.html @@ -0,0 +1,272 @@ + + + + +Main loop integeration + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Main loop integeration

+

Main loop integeration — Functions for integrating Cogl with an + application's main loop

+
+
+

Synopsis

+
enum                CoglPollFDEvent;
+                    CoglPollFD;
+void                cogl_poll_get_info                  (CoglContext *context,
+                                                         CoglPollFD **poll_fds,
+                                                         int *n_poll_fds,
+                                                         gint64 *timeout);
+void                cogl_poll_dispatch                  (CoglContext *context,
+                                                         const CoglPollFD *poll_fds,
+                                                         int n_poll_fds);
+GSource *           cogl_glib_source_new                (CoglContext *context,
+                                                         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. +

+

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_get_info ()

+
void                cogl_poll_get_info                  (CoglContext *context,
+                                                         CoglPollFD **poll_fds,
+                                                         int *n_poll_fds,
+                                                         gint64 *timeout);
+

+This should be called whenever an application is about to go idle +so that Cogl has a chance to describe what state it needs to be +woken up on. The assumption is that the application is using a main +loop with something like the poll function call on Unix or the GLib +main loop. +

+

+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. Either way it should pass a pointer to either array back to +Cogl when calling cogl_poll_dispatch(). +

+

+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 zero if +Cogl needs to be woken up immediately. +

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

context :

A CoglContext +

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.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_poll_dispatch ()

+
void                cogl_poll_dispatch                  (CoglContext *context,
+                                                         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 from +cogl_context_begin_idle() or a shorter array missing some file +descriptors that Cogl requested. +

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

context :

A CoglContext +

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.10

+

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_get_info() and cogl_poll_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(). +

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

context :

A CoglContext +

priority :

The priority of the GSource +

Returns :

a new GSource +
+

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-Matrices.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrices.html new file mode 100644 index 0000000..236f917 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Matrices.html @@ -0,0 +1,1108 @@ + + + + +Matrices + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Matrices

+

Matrices — Fuctions 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);
+CoglMatrix *        cogl_matrix_copy                    (const CoglMatrix *matrix);
+gboolean            cogl_matrix_equal                   (gconstpointer v1,
+                                                         gconstpointer 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_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);
+gboolean            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);
+gboolean            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
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
.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_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() +
+

Since 1.6

+
+
+
+

cogl_matrix_equal ()

+
gboolean            cogl_matrix_equal                   (gconstpointer v1,
+                                                         gconstpointer 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_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 ()

+
gboolean            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
typedef struct {
+  float x,y;
+  guint8 r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  guint8 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
typedef struct {
+  float x,y;
+  guint8 r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  guint8 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 ()

+
gboolean            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-Offscreen-Framebuffers.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Offscreen-Framebuffers.html new file mode 100644 index 0000000..6bc2938 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Offscreen-Framebuffers.html @@ -0,0 +1,120 @@ + + + + +Offscreen Framebuffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Offscreen Framebuffers

+

Offscreen Framebuffers — Fuctions for creating and manipulating offscreen + framebuffers.

+
+
+

Synopsis

+
CoglOffscreen *     cogl_offscreen_new_to_texture       (CoglTexture *texture);
+gboolean            cogl_is_offscreen                   (void *object);
+
+
+
+

Description

+

+Cogl allows creating and operating on offscreen framebuffers. +

+
+
+

Details

+
+

cogl_offscreen_new_to_texture ()

+
CoglOffscreen *     cogl_offscreen_new_to_texture       (CoglTexture *texture);
+

+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 ()

+
gboolean            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
+
+
+
+ + + \ 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..86afa83 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Path-Primitives.html @@ -0,0 +1,796 @@ + + + + +Path Primitives + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Path Primitives

+

Path Primitives — Functions for constructing and drawing 2D paths.

+
+
+

Synopsis

+
gboolean            cogl_is_path                        (CoglHandle handle);
+void                cogl_path_new                       (void);
+CoglPath *          cogl_path_copy                      (CoglPath *path);
+void                cogl_path_move_to                   (float x,
+                                                         float y);
+void                cogl_path_close                     (void);
+void                cogl_path_line_to                   (float x,
+                                                         float y);
+void                cogl_path_curve_to                  (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+void                cogl_path_arc                       (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y,
+                                                         float angle_1,
+                                                         float angle_2);
+void                cogl_path_rel_move_to               (float x,
+                                                         float y);
+void                cogl_path_rel_line_to               (float x,
+                                                         float y);
+void                cogl_path_rel_curve_to              (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+void                cogl_path_line                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_path_polyline                  (const float *coords,
+                                                         int num_points);
+void                cogl_path_polygon                   (const float *coords,
+                                                         int num_points);
+void                cogl_path_rectangle                 (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_path_round_rectangle           (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float radius,
+                                                         float arc_step);
+void                cogl_path_ellipse                   (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y);
+
+enum                CoglPathFillRule;
+void                cogl_path_set_fill_rule             (CoglPathFillRule fill_rule);
+CoglPathFillRule    cogl_path_get_fill_rule             (void);
+void                cogl_path_fill                      (void);
+void                cogl_path_stroke                    (void);
+
+
+
+

Description

+

+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. +

+
+
+

Details

+
+

cogl_is_path ()

+
gboolean            cogl_is_path                        (CoglHandle handle);
+

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

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

object :

A CoglObject +

Returns :

+TRUE if the object references a CoglPath, +FALSE otherwise.
+

Since 2.0

+
+
+
+

cogl_path_new ()

+
void                cogl_path_new                       (void);
+

+Creates a new, empty path object. The default fill rule is +COGL_PATH_FILL_RULE_EVEN_ODD. +

+
++ + + + +

Returns :

A pointer to a newly allocated CoglPath, which can +be freed using cogl_object_unref().
+

Since 2.0

+
+
+
+

cogl_path_copy ()

+
CoglPath *          cogl_path_copy                      (CoglPath *path);
+

+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. +

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

path :

A CoglPath object

Returns :

a copy of the path in path.
+

Since 2.0

+
+
+
+

cogl_path_move_to ()

+
void                cogl_path_move_to                   (float x,
+                                                         float y);
+

+Moves the pen to the given location. If there is an existing path +this will start a new disjoint subpath. +

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

x :

X coordinate of the pen location to move to.

y :

Y coordinate of the pen location to move to.
+

Since 2.0

+
+
+
+

cogl_path_close ()

+
void                cogl_path_close                     (void);
+

+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

+
+
+
+

cogl_path_line_to ()

+
void                cogl_path_line_to                   (float x,
+                                                         float y);
+

+Adds a straight line segment to the current path that ends at the +given coordinates. +

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

x :

X coordinate of the end line vertex

y :

Y coordinate of the end line vertex
+

Since 2.0

+
+
+
+

cogl_path_curve_to ()

+
void                cogl_path_curve_to                  (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+

+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. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_arc ()

+
void                cogl_path_arc                       (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y,
+                                                         float angle_1,
+                                                         float angle_2);
+

+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). +

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

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
+

Since 2.0

+
+
+
+

cogl_path_rel_move_to ()

+
void                cogl_path_rel_move_to               (float x,
+                                                         float y);
+

+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. +

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

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.
+

Since 2.0

+
+
+
+

cogl_path_rel_line_to ()

+
void                cogl_path_rel_line_to               (float x,
+                                                         float y);
+

+Adds a straight line segment to the current path that ends at the +given coordinates relative to the current pen location. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_rel_curve_to ()

+
void                cogl_path_rel_curve_to              (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+

+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. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_line ()

+
void                cogl_path_line                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+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. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_polyline ()

+
void                cogl_path_polyline                  (const float *coords,
+                                                         int num_points);
+

+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. +

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

coords :

A pointer to the first element of an +array of fixed-point values that specify the vertex coordinates. [in][array][transfer none] +

num_points :

The total number of vertices.
+

Since 2.0

+
+
+
+

cogl_path_polygon ()

+
void                cogl_path_polygon                   (const float *coords,
+                                                         int num_points);
+

+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. +

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

coords :

A pointer to the first element of +an array of fixed-point values that specify the vertex coordinates. [in][array][transfer none] +

num_points :

The total number of vertices.
+

Since 2.0

+
+
+
+

cogl_path_rectangle ()

+
void                cogl_path_rectangle                 (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+Constructs a rectangular shape at the given coordinates. If there +is an existing path this will start a new disjoint sub-path. +

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

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 2.0

+
+
+
+

cogl_path_round_rectangle ()

+
void                cogl_path_round_rectangle           (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float radius,
+                                                         float arc_step);
+

+Constructs a rectangular shape with rounded corners. If there is an +existing path this will start a new disjoint sub-path. +

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

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.
+

Since 2.0

+
+
+
+

cogl_path_ellipse ()

+
void                cogl_path_ellipse                   (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y);
+

+Constructs an ellipse shape. If there is an existing path this will +start a new disjoint sub-path. +

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

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
+

Since 2.0

+
+
+
+

enum CoglPathFillRule

+
typedef enum {
+  COGL_PATH_FILL_RULE_NON_ZERO,
+  COGL_PATH_FILL_RULE_EVEN_ODD
+} CoglPathFillRule;
+
+

+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 is COGL_PATH_FILL_RULE_EVEN_ODD. The fill +rule is attached to the current path so preserving a path with +cogl_get_path() also preserves the fill rule. Calling +cogl_path_new() resets the current fill rule to the default. +

+

+

+
+

Figure 2. Example of filling various paths using the non-zero rule

+
Example of filling various paths using the non-zero rule
+
+


+

+

+

+
+

Figure 3. Example of filling various paths using the even-odd rule

+
Example of filling various paths using the even-odd rule
+
+


+

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

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 Figure 2, “Example of filling various paths using the non-zero rule”. +

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 Figure 3, “Example of filling various paths using the even-odd rule”. +
+

Since 1.4

+
+
+
+

cogl_path_set_fill_rule ()

+
void                cogl_path_set_fill_rule             (CoglPathFillRule 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. +

+
++ + + + +

fill_rule :

The new fill rule.
+

Since 2.0

+
+
+
+

cogl_path_get_fill_rule ()

+
CoglPathFillRule    cogl_path_get_fill_rule             (void);
+

+Retrieves the fill rule set using cogl_path_set_fill_rule(). +

+
++ + + + +

Returns :

the fill rule that is used for the current path.
+

Since 2.0

+
+
+
+

cogl_path_fill ()

+
void                cogl_path_fill                      (void);
+

+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. +

+

+

+
+

Note

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

+
+
+
+

cogl_path_stroke ()

+
void                cogl_path_stroke                    (void);
+

+Strokes the constructed shape using the current drawing color and a +width of 1 pixel (regardless of the current transformation +matrix). +

+

Since 2.0

+
+
+
+ + + \ 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..ce434dc --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Pipeline.html @@ -0,0 +1,2247 @@ + + + + +Pipeline + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Pipeline

+

Pipeline — Functions for creating and manipulating the GPU + pipeline

+
+
+

Synopsis

+
CoglPipeline *      cogl_pipeline_new                   (CoglContext *context);
+CoglPipeline *      cogl_pipeline_copy                  (CoglPipeline *source);
+gboolean            cogl_is_pipeline                    (CoglHandle handle);
+void                cogl_pipeline_set_color             (CoglPipeline *pipeline,
+                                                         const CoglColor *color);
+void                cogl_pipeline_set_color4ub          (CoglPipeline *pipeline,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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);
+void                cogl_pipeline_set_alpha_test_function
+                                                        (CoglPipeline *pipeline,
+                                                         CoglPipelineAlphaFunc alpha_func,
+                                                         float alpha_reference);
+#define             COGL_BLEND_STRING_ERROR
+enum                CoglBlendStringError;
+gboolean            cogl_pipeline_set_blend             (CoglPipeline *pipeline,
+                                                         const char *blend_string,
+                                                         GError **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);
+CoglColorMask       cogl_pipeline_get_color_mask        (CoglPipeline *pipeline);
+void                cogl_pipeline_set_color_mask        (CoglPipeline *pipeline,
+                                                         CoglColorMask color_mask);
+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 texure_type);
+CoglTexture *       cogl_pipeline_get_layer_texture     (CoglPipeline *pipeline,
+                                                         int layer_index);
+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);
+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);
+gboolean            cogl_pipeline_set_layer_combine     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         GError **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);
+gboolean            cogl_pipeline_set_layer_point_sprite_coords_enabled
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         gboolean enable,
+                                                         GError **error);
+gboolean            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);
+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,
+                                                         gboolean 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

+
+

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 +
+

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 +
+

Since 2.0

+

Stability Level: Unstable

+
+
+
+

cogl_is_pipeline ()

+
gboolean            cogl_is_pipeline                    (CoglHandle handle);
+

+Gets whether the given handle references an existing pipeline object. +

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

handle :

A CoglHandle

Returns :

+TRUE if the handle 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,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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

+
+
+
+

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 ())
+
+

+GError 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 ()

+
gboolean            cogl_pipeline_set_blend             (CoglPipeline *pipeline,
+                                                         const char *blend_string,
+                                                         GError **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
<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
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 GError 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 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. +

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

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_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

+
+
+
+

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 +

+

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 texure_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.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

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%. +

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

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

+
+
+
+

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 ()

+
gboolean            cogl_pipeline_set_layer_combine     (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         GError **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_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
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_constant.

+
+ + + + + + + +
1
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 GError 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 ()

+
gboolean            cogl_pipeline_set_layer_point_sprite_coords_enabled
+                                                        (CoglPipeline *pipeline,
+                                                         int layer_index,
+                                                         gboolean enable,
+                                                         GError **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_POINT_SPRITE is +available. If the feature is not available then the function will +return FALSE and set error. +

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

pipeline :

a CoglHandle to a pipeline.

layer_index :

the layer number to change.

enable :

whether to enable point sprite coord generation.

error :

A return location for a GError, 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 ()

+
gboolean            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 CoglHandle to a pipeline.

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

+
+
+
+

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

user_data :

Private data that will be passed to the callback
+

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,
+                                                         gboolean 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..648d307 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Primitives.html @@ -0,0 +1,1266 @@ + + + + +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);
+gboolean            cogl_is_primitive                   (void *object);
+int                 cogl_primitive_get_first_vertex     (CoglPrimitive *primitive);
+void                cogl_primitive_set_first_vertex     (CoglPrimitive *primitive,
+                                                         int first_vertex);
+#define             cogl_primitive_get_n_vertices
+#define             cogl_primitive_set_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);
+#define             cogl_primitive_set_indices
+CoglPrimitive *     cogl_primitive_copy                 (CoglPrimitive *primitive);
+gboolean            (*CoglPrimitiveAttributeCallback)   (CoglPrimitive *primitive,
+                                                         CoglAttribute *attribute,
+                                                         void *user_data);
+void                cogl_primitive_foreach_attribute    (CoglPrimitive *primitive,
+                                                         CoglPrimitiveAttributeCallback callback,
+                                                         void *user_data);
+
+
+
+

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 +"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

Varargs :

A NULL terminated list of attributes

Returns :

A newly allocated CoglPrimitive object
+

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);
+
+
+
+

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
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 +"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 :

An array of CoglVertexP2 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

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
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 +"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 :

An array of CoglVertexP3 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

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
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 +"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 :

An array of CoglVertexP2C4 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

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
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 +"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 :

An array of CoglVertexP3C4 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

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
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 +"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 :

An array of CoglVertexP2T2 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

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
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 +"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 :

An array of CoglVertexP3T2 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

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
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 +"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 :

An array of CoglVertexP2T2C4 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

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
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 +"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 :

An array of CoglVertexP3T2C4 vertices

Returns :

A newly allocated CoglPrimitive with a reference of +1. This can be freed using cogl_object_unref().
+

Since 1.6

+

Stability Level: Unstable

+
+
+
+

cogl_is_primitive ()

+
gboolean            cogl_is_primitive                   (void *object);
+

+Gets whether the given object references a CoglPrimitive. +

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

object :

A CoglObject +

Returns :

+TRUE if the handle 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

+
#define cogl_primitive_get_n_vertices cogl_primitive_get_n_vertices_EXP
+
+

+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

+
#define cogl_primitive_set_n_vertices cogl_primitive_set_n_vertices_EXP
+
+

+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 :

A NULL terminated array of CoglAttribute +pointers
+

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.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_primitive_set_indices

+
#define cogl_primitive_set_indices cogl_primitive_set_indices_EXP
+
+

+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 +"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 "first_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
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

CoglPrimitiveAttributeCallback ()

+
gboolean            (*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

user_data :

Private data that will be passed to the 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-Quaternions-(Rotations).html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Quaternions-(Rotations).html new file mode 100644 index 0000000..eebd988 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Quaternions-(Rotations).html @@ -0,0 +1,773 @@ + + + + +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);
+gboolean            cogl_quaternion_equal               (gconstpointer v1,
+                                                         gconstpointer 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. +(http://en.wikipedia.org/wiki/Gimbal_lock). +

+
+
+

Details

+
+

CoglQuaternion

+
typedef struct {
+  float w;
+
+  float x;
+  float y;
+  float z;
+
+  float padding0;
+  float padding1;
+  float padding2;
+  float padding3;
+} 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 <pre>[w (x, y, z)]</pre>. +

+

+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
[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
sqrt (w² + x² + y² + z²)
+
+ +

+and a unit quaternion satisfies this equation: +

+
+ + + + + + + +
1
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: +

+

+

+ +

+

+

+@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 +

+
+
+
+

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 +

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 (x,y,z),w
+

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 y axis
+

Since 2.0

+
+
+
+

cogl_quaternion_equal ()

+
gboolean            cogl_quaternion_equal               (gconstpointer v1,
+                                                         gconstpointer 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 +
+

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. +

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

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 +
+

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() +
  • +
+

+

+
+
+
+

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);
+

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..012e77b --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangle-textures-(non-normalized-coordinates).html @@ -0,0 +1,174 @@ + + + + +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

+
#define             cogl_texture_rectangle_new_with_size
+

+Allocates a new CoglRectangle texture with a given width, height +and internal_format. This texture is a low-level texture that +the GPU can sample from directly unlike high-level textures such +as CoglTexture2DSliced and CoglAtlasTexture. +

+

+

+
+

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().
+

+

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

context :

A CoglContext pointer

width :

The texture width to allocate

height :

The texture height to allocate

internal_format :

The desired internal texture format

error :

An optional GError pointer for reporting exceptions

Returns :

A pointer to a newly allocated CoglRectangle texture +or if the size was too large or there wasn't enough memory +NULL is returned and error set.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_texture_rectangle

+
#define cogl_is_texture_rectangle cogl_is_texture_rectangle_EXP
+
+

+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..195eca9 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Rectangles.html @@ -0,0 +1,288 @@ + + + + +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-Shader-snippets.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Shader-snippets.html new file mode 100644 index 0000000..967b92d --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Shader-snippets.html @@ -0,0 +1,917 @@ + + + + +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);
+gboolean            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 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. +

+
+

+

+

+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,
+
+  /* Per pipeline fragment hooks */
+  COGL_SNIPPET_HOOK_FRAGMENT = 2048,
+
+  /* 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
+
+

+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_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_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. +
+

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 ()

+
gboolean            cogl_is_snippet                     (void *object);
+

+Gets whether the given handle references an existing snippet object. +

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

handle :

A CoglHandle

Returns :

+TRUE if the handle 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..7783af2 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sliced-Textures.html @@ -0,0 +1,179 @@ + + + + +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,
+                                                         unsigned int width,
+                                                         unsigned int height,
+                                                         int max_waste,
+                                                         CoglPixelFormat internal_format,
+                                                         GError **error);
+gboolean            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,
+                                                         unsigned int width,
+                                                         unsigned int height,
+                                                         int max_waste,
+                                                         CoglPixelFormat internal_format,
+                                                         GError **error);
+

+Creates a CoglTexture2DSliced that may internally be comprised of +1 or more CoglTexture2D textures with power-of-two sizes. +max_waste is used as a threshold for recursively slicing the +right-most or bottom-most slices into smaller power-of-two sizes +until the wasted padding at the bottom and right of the +power-of-two textures is less than specified. +

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

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 in the non-power-of-two textures before +they must be sliced to reduce the amount of waste.

internal_format :

The format of the texture

error :

A GError for exceptions.

Returns :

A newly allocated CoglTexture2DSliced or if there was +an error allocating any of the internal slices NULL is +returned and error is updated.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_texture_2d_sliced ()

+
gboolean            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..7a1c47e --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Sub-Textures.html @@ -0,0 +1,156 @@ + + + + +Sub Textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Sub Textures

+

Sub Textures — Functions for creating and manipulating + sub-textures.

+
+
+

Synopsis

+
                    CoglSubTexture;
+#define             cogl_sub_texture_new
+#define             cogl_is_sub_texture
+
+
+
+

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

+
#define cogl_sub_texture_new cogl_sub_texture_new_EXP
+
+

+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.
+

+

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

context :

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.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_sub_texture

+
#define cogl_is_sub_texture cogl_is_sub_texture_EXP
+
+

+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..00a6bf0 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Object-Interface.html @@ -0,0 +1,177 @@ + + + + +The Object Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

The Object Interface

+

The Object Interface

+
+
+

Synopsis

+
                    CoglObject;
+void *              cogl_object_ref                     (void *object);
+void                cogl_object_unref                   (void *object);
+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;
+
+
+
+

cogl_object_ref ()

+
void *              cogl_object_ref                     (void *object);
+

+Increases the reference count of handle 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 +
+
+
+
+

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..7bf1637 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Texture-Interface.html @@ -0,0 +1,337 @@ + + + + +The Texture Interface + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

The Texture Interface

+

The Texture Interface — Fuctions for creating and manipulating textures

+
+
+

Synopsis

+
                    CoglTexture;
+gboolean            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);
+gboolean            cogl_texture_is_sliced              (CoglTexture *texture);
+int                 cogl_texture_get_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         guint8 *data);
+gboolean            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 guint8 *data);
+enum                CoglTextureType;
+
+
+
+

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 struct _CoglTexture CoglTexture;
+
+
+
+

cogl_is_texture ()

+
gboolean            cogl_is_texture                     (void *object);
+

+Gets whether the given object references a texture object. +

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

object :

A CoglObject pointer

Returns :

+TRUE if the handle 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. +

+
++ + + + +

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. +

+
++ + + + +

Returns :

the height of the GPU side texture in pixels
+
+
+
+

cogl_texture_get_format ()

+
CoglPixelFormat     cogl_texture_get_format             (CoglTexture *texture);
+

+Queries the CoglPixelFormat of a cogl texture. +

+
++ + + + +

Returns :

the CoglPixelFormat of the GPU side texture
+
+
+
+

cogl_texture_is_sliced ()

+
gboolean            cogl_texture_is_sliced              (CoglTexture *texture);
+

+Queries if a texture is sliced (stored as multiple GPU side tecture +objects). +

+
++ + + + +

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,
+                                                         guint8 *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
+

+

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

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 ()

+
gboolean            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 guint8 *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 +
+

+

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

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

+
+
+
+ + + \ 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..cb4261c --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-The-Top-Level-Context.html @@ -0,0 +1,1268 @@ + + + + +The Top-Level Context + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

The Top-Level Context

+

The Top-Level Context — The top level application context.

+
+
+

Synopsis

+
CoglContext *       cogl_context_new                    (CoglDisplay *display,
+                                                         GError **error);
+gboolean            cogl_is_context                     (void *object);
+CoglDisplay *       cogl_context_get_display            (CoglContext *context);
+
+enum                CoglFeatureID;
+gboolean            cogl_has_feature                    (CoglContext *context,
+                                                         CoglFeatureID feature);
+gboolean            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            (guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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);
+
+#define             COGL_TYPE_BUFFER_BIT
+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,
+                                                         guint8 *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. +

+
+
+

Details

+
+

cogl_context_new ()

+
CoglContext *       cogl_context_new                    (CoglDisplay *display,
+                                                         GError **error);
+

+Creates a new CoglContext which acts as an application sandbox +for any state objects that are allocated. +

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

display :

A CoglDisplay pointer

error :

A GError return location.

Returns :

A newly allocated CoglContext. [transfer full] +
+

Since 1.8

+

Stability Level: Unstable

+
+
+
+

cogl_is_context ()

+
gboolean            cogl_is_context                     (void *object);
+

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

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

object :

An object or NULL +

Returns :

+TRUE if the handle references a CoglContext, +FALSE otherwise
+

Since 1.10

+

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,
+} 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_RENDERER_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_RENDERER_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_RENDERER_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. +
+

Since 1.10

+
+
+
+

cogl_has_feature ()

+
gboolean            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 ()

+
gboolean            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

user_data :

Private data to pass to the callback
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_push_matrix ()

+
void                cogl_push_matrix                    (void);
+

+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);
+

+Restores the current model-view matrix from the matrix stack. +

+
+
+
+

cogl_scale ()

+
void                cogl_scale                          (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. +

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

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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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]);
+

+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);
+

+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);
+

+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            (guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 alpha);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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_TYPE_BUFFER_BIT

+
#define COGL_TYPE_BUFFER_BIT (cogl_buffer_bit_get_type())
+
+
+
+
+

cogl_clear ()

+
void                cogl_clear                          (const CoglColor *color,
+                                                         unsigned long  buffers);
+

+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_read_pixels() +

+
++ + + + +

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,
+                                                         guint8 *pixels);
+

+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-Vertex-Attributes.html b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Vertex-Attributes.html new file mode 100644 index 0000000..6717a37 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-Vertex-Attributes.html @@ -0,0 +1,346 @@ + + + + +Vertex Attributes + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Vertex Attributes

+

Vertex Attributes — Functions for declaring and drawing vertex + attributes

+
+
+

Synopsis

+
CoglAttribute *     cogl_attribute_new                  (CoglAttributeBuffer *attribute_buffer,
+                                                         const char *name,
+                                                         gsize stride,
+                                                         gsize offset,
+                                                         int components,
+                                                         CoglAttributeType type);
+gboolean            cogl_is_attribute                   (void *object);
+void                cogl_attribute_set_normalized       (CoglAttribute *attribute,
+                                                         gboolean normalized);
+gboolean            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

+
+

cogl_attribute_new ()

+
CoglAttribute *     cogl_attribute_new                  (CoglAttributeBuffer *attribute_buffer,
+                                                         const char *name,
+                                                         gsize stride,
+                                                         gsize 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)
  • +
+

+

+

+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
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
MyVertex vertices[100] = { .... }
+
+ +

+

+

+In this case, to describe either the position or texture coordinate +attribute you have to move <pre>sizeof (MyVertex)</pre> 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 <pre>(2 * sizeof (float))</pre>. 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 <pre>MyVertex</pre> example above the offset is the +offset inside the <pre>MyVertex</pre> structure to the first +component of the attribute. For the texture coordinate attribute +the offset would be <pre>offsetof (MyVertex, s)</pre> or instead of +using the offsetof macro you could use <pre>sizeof (float) * 3</pre>. +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 +<pre>sizeof (MyVertex)</pre>)

offset :

The byte offset from the start of attribute_buffer for +the first attribute value. (Usually +<pre>offsetof (MyVertex, component0)</pre> +

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.
+

Since 1.4

+

Stability Level: Unstable

+
+
+
+

cogl_is_attribute ()

+
gboolean            cogl_is_attribute                   (void *object);
+

+Gets whether the given object references a CoglAttribute. +

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

object :

A CoglObject +

Returns :

+TRUE if the handle references a CoglAttribute, +FALSE otherwise
+
+
+
+

cogl_attribute_set_normalized ()

+
void                cogl_attribute_set_normalized       (CoglAttribute *attribute,
+                                                         gboolean 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 ()

+
gboolean            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().
+

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..3c58d44 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental-X11-Texture-From-Pixmap.html @@ -0,0 +1,253 @@ + + + + +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 * cogl_texture_pixmap_x11_new      (CoglContext *context,
+                                                         guint32 pixmap,
+                                                         gboolean automatic_updates,
+                                                         GError **error);
+void                cogl_texture_pixmap_x11_update_area (CoglTexturePixmapX11 *texture,
+                                                         int x,
+                                                         int y,
+                                                         int width,
+                                                         int height);
+gboolean            cogl_texture_pixmap_x11_is_using_tfp_extension
+                                                        (CoglTexturePixmapX11 *texture);
+void                cogl_texture_pixmap_x11_set_damage_object
+                                                        (CoglTexturePixmapX11 *texture,
+                                                         guint32 damage,
+                                                         CoglTexturePixmapX11ReportLevel report_level);
+gboolean            cogl_is_texture_pixmap_x11          (void *object);
+
+
+
+

Description

+

+These functions allow high-level meta textures (See the +CoglMetaTexture interface) that derive their contents from an X11 +pixmap. +

+
+
+

Details

+
+

cogl_texture_pixmap_x11_new ()

+
CoglTexturePixmapX11 * cogl_texture_pixmap_x11_new      (CoglContext *context,
+                                                         guint32 pixmap,
+                                                         gboolean automatic_updates,
+                                                         GError **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 GError 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 ()

+
gboolean            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

+
+
+
+

cogl_texture_pixmap_x11_set_damage_object ()

+
void                cogl_texture_pixmap_x11_set_damage_object
+                                                        (CoglTexturePixmapX11 *texture,
+                                                         guint32 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

+
+
+
+

cogl_is_texture_pixmap_x11 ()

+
gboolean            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

+
+
+
+ + + \ 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..2493a03 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/cogl-2.0-experimental.devhelp2 @@ -0,0 +1,547 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..0140305 --- /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..2923a68 --- /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..beb4849 --- /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-framebuffer-apis.html b/doc/reference/cogl-2.0-experimental/html/cogl-framebuffer-apis.html new file mode 100644 index 0000000..e411682 --- /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-integration.html b/doc/reference/cogl-2.0-experimental/html/cogl-integration.html new file mode 100644 index 0000000..3993b00 --- /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..3abb5f2 --- /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..c314256 --- /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..dcd978d --- /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-textures.html b/doc/reference/cogl-2.0-experimental/html/cogl-textures.html new file mode 100644 index 0000000..f06c323 --- /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..d6f129f --- /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 0000000..2c2a1fd Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/cogl_ortho.png differ 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..fabc31a --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/coglglossary.html @@ -0,0 +1,57 @@ + + + + +Glossaries + + + + + + + + + + + + + + + + +
+

+Glossaries

+ +
+

+Annotation Glossary

+

A

+
+array
+

Parameter points to an array of items.

+

O

+
+out
+

Parameter for returning results. Default is transfer full.

+

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-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 0000000..1e4fbb0 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/fill-rule-even-odd.png differ 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 0000000..2d8ad31 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/fill-rule-non-zero.png differ diff --git a/doc/reference/cogl-2.0-experimental/html/home.png b/doc/reference/cogl-2.0-experimental/html/home.png new file mode 100644 index 0000000..1700361 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/home.png differ 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..67cd733 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/index.html @@ -0,0 +1,197 @@ + + + + +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
+
+The Object Interface +
+
+The Top-Level Context — The top level application context. +
+
+Main loop integeration — Functions for integrating Cogl with an + application's main loop +
+
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 +
+
+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 +
+
+Indices +
+
+
Geometry
+
+
+Primitives — Functions for creating, manipulating and drawing + primitives +
+
+Path Primitives — Functions for constructing and drawing 2D paths. +
+
+Rectangles +
+
+
Textures
+
+
+The Texture Interface — Fuctions for creating and manipulating textures +
+
+2D textures — Functions for creating and manipulating 2D textures +
+
+3D textures — Fuctions for creating and manipulating 3D textures +
+
+Rectangle textures (non-normalized coordinates) — Functions for creating and manipulating rectangle + textures for use with non-normalized coordinates. +
+
+
Meta Textures
+
+
+High Level Meta Textures — Interface 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. +
+
+
Framebuffers
+
+
+CoglFramebuffer: The Framebuffer Interface — A common interface for manipulating framebuffers +
+
+Offscreen Framebuffers — Fuctions for creating and manipulating offscreen + framebuffers. +
+
+
Utilities
+
+
+Color Type — A generic color definition +
+
+Matrices — Fuctions for initializing and manipulating 4x4 matrices +
+
+3 Component Vectors — Functions for handling single precision float + vectors. +
+
+Quaternions (Rotations) — Functions for initializing and manipulating +quaternions. +
+
+Common Types +
+
+
Binding and Integrating
+
+GType Integration API +
+
+
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..aaaa5b5 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/index.sgml @@ -0,0 +1,603 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..6b00394 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix01.html @@ -0,0 +1,1822 @@ + + + + +Index of all symbols + + + + + + + + + + + + + + + + + + + +
+

+Index of all symbols

+

A

+
+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_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

+
+CoglBlendStringError, enum in Pipeline +
+
+
+COGL_BLEND_STRING_ERROR, macro in Pipeline +
+
+
+CoglBufferAccess, enum in CoglBuffer: The Buffer Interface +
+
+
+CoglBufferBit, enum in Common Types +
+
+
+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_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_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_unpremultiply, function in Color Type +
+
+
+cogl_context_get_display, function in The Top-Level Context +
+
+
+cogl_context_new, function in The Top-Level Context +
+
+

D

+
+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_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

+
+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 +
+
+
+cogl_flush, function in The Top-Level Context +
+
+
+cogl_foreach_feature, function in The Top-Level Context +
+
+
+CoglFramebuffer, struct in CoglFramebuffer: The Framebuffer Interface +
+
+
+COGL_FRAMEBUFFER, macro in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_allocate, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_clear, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_clear4f, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_attributes, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_indexed_attributes, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_multitextured_rectangle, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_draw_primitive, 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_blue_bits, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_get_color_format, 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_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_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_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_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 +
+
+
+cogl_framebuffer_vdraw_attributes, function in CoglFramebuffer: The Framebuffer Interface +
+
+
+cogl_framebuffer_vdraw_indexed_attributes, function in CoglFramebuffer: The 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_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 +
+
+
+cogl_glib_source_new, function in Main loop integeration +
+
+
+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 +
+
+
+cogl_indices_new, function in Indices +
+
+
+cogl_is_attribute, function in Vertex Attributes +
+
+
+cogl_is_attribute_buffer, function in CoglAttributeBuffer: Buffers of vertex attributes +
+
+
+cogl_is_buffer, function in CoglBuffer: The Buffer Interface +
+
+
+cogl_is_context, function in The Top-Level 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_path, function in Path Primitives +
+
+
+cogl_is_pipeline, function in Pipeline +
+
+
+cogl_is_pixel_buffer, macro in CoglBuffer: The Buffer Interface +
+
+
+cogl_is_primitive, function in Primitives +
+
+
+cogl_is_snippet, function in Shader snippets +
+
+
+cogl_is_sub_texture, macro in Sub Textures +
+
+
+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, macro in Rectangle textures (non-normalized coordinates) +
+
+

M

+
+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_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_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 +
+
+
+CoglMetaTexture, struct 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 +
+
+
+cogl_offscreen_new_to_texture, function in Offscreen Framebuffers +
+
+
+COGL_ONSCREEN, macro in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+CoglOnscreen, struct 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_set_swap_throttled, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_show, function in CoglOnscreen: The Onscreen Framebuffer Interface +
+
+
+cogl_onscreen_template_new, macro in CoglOnscreenTemplate: Describe a template for onscreen framebuffers +
+
+
+cogl_ortho, function in The Top-Level Context +
+
+

P

+
+CoglPathFillRule, enum in Path Primitives +
+
+
+cogl_path_arc, function in Path Primitives +
+
+
+cogl_path_close, function in Path Primitives +
+
+
+cogl_path_copy, function in Path Primitives +
+
+
+cogl_path_curve_to, function in Path Primitives +
+
+
+cogl_path_ellipse, function in Path Primitives +
+
+
+cogl_path_fill, function in Path Primitives +
+
+
+cogl_path_get_fill_rule, function in Path Primitives +
+
+
+cogl_path_line, function in Path Primitives +
+
+
+cogl_path_line_to, function in Path Primitives +
+
+
+cogl_path_move_to, function in Path Primitives +
+
+
+cogl_path_new, function in Path Primitives +
+
+
+cogl_path_polygon, function in Path Primitives +
+
+
+cogl_path_polyline, function in Path Primitives +
+
+
+cogl_path_rectangle, function in Path Primitives +
+
+
+cogl_path_rel_curve_to, function in Path Primitives +
+
+
+cogl_path_rel_line_to, function in Path Primitives +
+
+
+cogl_path_rel_move_to, function in Path Primitives +
+
+
+cogl_path_round_rectangle, function in Path Primitives +
+
+
+cogl_path_set_fill_rule, function in Path Primitives +
+
+
+cogl_path_stroke, function in Path Primitives +
+
+
+cogl_perspective, function in The Top-Level Context +
+
+
+CoglPipelineCullFaceMode, 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_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_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_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_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 +
+
+
+CoglPixelFormat, enum in Common Types +
+
+
+cogl_pixel_buffer_new, macro in CoglBuffer: The Buffer Interface +
+
+
+CoglPollFD, struct in Main loop integeration +
+
+
+CoglPollFDEvent, enum in Main loop integeration +
+
+
+cogl_poll_dispatch, function in Main loop integeration +
+
+
+cogl_poll_get_info, function in Main loop integeration +
+
+
+cogl_polygon, function in Primitives (Deprecated) +
+
+
+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 +
+
+
+CoglPrimitive, struct in Primitives +
+
+
+CoglPrimitiveAttributeCallback, user_function in Primitives +
+
+
+cogl_primitive_copy, 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, macro 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, macro in Primitives +
+
+
+cogl_primitive_set_mode, function in Primitives +
+
+
+cogl_primitive_set_n_vertices, macro in Primitives +
+
+
+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 +
+
+

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

+
+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 +
+
+
+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_new, 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_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, macro in Sub Textures +
+
+
+cogl_swap_chain_new, macro in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+
+cogl_swap_chain_set_has_alpha, macro in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+
+cogl_swap_chain_set_length, macro in CoglSwapChain: Describe a set of back buffers for flipping between +
+
+

T

+
+CoglTexture, struct in The Texture Interface +
+
+
+CoglTexture2D, struct in 2D textures +
+
+
+CoglTexture2DSliced, struct in Sliced Textures +
+
+
+CoglTexture3D, struct in 3D textures +
+
+
+CoglTextureRectangle, struct in Rectangle textures (non-normalized coordinates) +
+
+
+CoglTextureType, enum in The Texture Interface +
+
+
+cogl_texture_2d_new_from_data, macro in 2D textures +
+
+
+cogl_texture_2d_new_from_foreign, macro in 2D textures +
+
+
+cogl_texture_2d_new_with_size, macro in 2D textures +
+
+
+cogl_texture_2d_sliced_new_with_size, function in Sliced 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 The Texture Interface +
+
+
+cogl_texture_get_format, function in The Texture Interface +
+
+
+cogl_texture_get_height, 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_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_with_size, macro in Rectangle textures (non-normalized coordinates) +
+
+
+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 +
+
+
+COGL_TYPE_BUFFER_BIT, macro in The Top-Level Context +
+
+

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 +
+
+

W

+
+cogl_wayland_display_set_compositor_display, function in CoglDisplay: Setup a display pipeline +
+
+
+cogl_wayland_renderer_get_compositor, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_wayland_renderer_get_display, function in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_wayland_renderer_set_foreign_compositor, 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 +
+
+
+CoglWinding, enum in Pipeline +
+
+

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_get_foreign_display, macro in CoglRenderer: Connect to a backend renderer +
+
+
+cogl_xlib_renderer_set_foreign_display, macro 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..e6b7680 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix02.html @@ -0,0 +1,42 @@ + + + + +Index of deprecated symbols + + + + + + + + + + + + + + + + + + + +
+

+Index of deprecated symbols

+

C

+
+cogl_color_set_from_4f, function in Color Type +
+
+
+cogl_color_set_from_4ub, function in Color Type +
+
+
+ + + \ 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..9efa701 --- /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..ccd46c6 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix04.html @@ -0,0 +1,201 @@ + + + + +Index of new symbols in 1.0 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 1.0

+

A

+
+CoglAttributeType, enum in Common Types +
+
+

B

+
+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 +
+
+

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 +
+
+
+ + + \ 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..a8fd760 --- /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..10e2673 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/ix06.html @@ -0,0 +1,233 @@ + + + + +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 +
+
+

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 +
+
+

P

+
+CoglPathFillRule, enum in Path Primitives +
+
+

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 +
+
+

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 0000000..2d05b3d Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/left.png differ diff --git a/doc/reference/cogl-2.0-experimental/html/license.html b/doc/reference/cogl-2.0-experimental/html/license.html new file mode 100644 index 0000000..1c36402 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/license.html @@ -0,0 +1,58 @@ + + + + +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 0000000..a31d95d Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/quad-indices-order.png differ 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 0000000..18c42c8 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/quad-indices-triangles.png differ 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 0000000..92832e3 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/right.png differ diff --git a/doc/reference/cogl-2.0-experimental/html/style.css b/doc/reference/cogl-2.0-experimental/html/style.css new file mode 100644 index 0000000..d6f6c26 --- /dev/null +++ b/doc/reference/cogl-2.0-experimental/html/style.css @@ -0,0 +1,266 @@ +.synopsis, .classsynopsis +{ + /* tango:aluminium 1/2 */ + background: #eeeeec; + border: solid 1px #d3d7cf; + padding: 0.5em; +} +.programlisting +{ + /* tango:sky blue 0/1 */ + background: #e6f3ff; + border: solid 1px #729fcf; + padding: 0.5em; +} +.variablelist +{ + padding: 4px; + margin-left: 3em; +} +.variablelist td:first-child +{ + vertical-align: top; +} + +@media screen { + sup a.footnote + { + position: relative; + top: 0em ! important; + + } + /* this is needed so that the local anchors are displayed below the naviagtion */ + div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name] + { + display: inline-block; + position: relative; + top:-5em; + } + /* this seems to be a bug in the xsl style sheets when generating indexes */ + div.index div.index + { + top: 0em; + } + /* make space for the fixed navigation bar and add space at the bottom so that + * link targets appear somewhat close to top + */ + body + { + padding-top: 3.2em; + padding-bottom: 20em; + } + /* style and size the navigation bar */ + table.navigation#top + { + position: fixed; + /* tango:scarlet red 0/1 */ + background: #ffe6e6; + border: solid 1px #ef2929; + margin-top: 0; + margin-bottom: 0; + top: 0; + left: 0; + height: 3em; + z-index: 10; + } + .navigation a, .navigation a:visited + { + /* tango:scarlet red 3 */ + color: #a40000; + } + .navigation a:hover + { + /* tango:scarlet red 1 */ + color: #ef2929; + } + td.shortcuts + { + /* tango:scarlet red 1 */ + color: #ef2929; + font-size: 80%; + white-space: nowrap; + } +} +@media print { + table.navigation { + visibility: collapse; + display: none; + } + div.titlepage table.navigation { + visibility: visible; + display: table; + /* tango:scarlet red 0/1 */ + background: #ffe6e6; + border: solid 1px #ef2929; + margin-top: 0; + margin-bottom: 0; + top: 0; + left: 0; + height: 3em; + } +} + +.navigation .title +{ + font-size: 200%; +} + +div.gallery-float +{ + float: left; + padding: 10px; +} +div.gallery-float img +{ + border-style: none; +} +div.gallery-spacer +{ + clear: both; +} + +a, a:visited +{ + text-decoration: none; + /* tango:sky blue 2 */ + color: #3465a4; +} +a:hover +{ + text-decoration: underline; + /* tango:sky blue 1 */ + color: #729fcf; +} + +div.table table +{ + border-collapse: collapse; + border-spacing: 0px; + /* tango:aluminium 3 */ + border: solid 1px #babdb6; +} + +div.table table td, div.table table th +{ + /* tango:aluminium 3 */ + border: solid 1px #babdb6; + padding: 3px; + vertical-align: top; +} + +div.table table th +{ + /* tango:aluminium 2 */ + background-color: #d3d7cf; +} + +hr +{ + /* tango:aluminium 3 */ + color: #babdb6; + background: #babdb6; + border: none 0px; + height: 1px; + clear: both; +} + +.footer +{ + padding-top: 3.5em; + /* tango:aluminium 3 */ + color: #babdb6; + text-align: center; + font-size: 80%; +} + +.warning +{ + /* tango:orange 0/1 */ + background: #ffeed9; + border-color: #ffb04f; +} +.note +{ + /* tango:chameleon 0/0.5 */ + background: #d8ffb2; + border-color: #abf562; +} +.note, .warning +{ + padding: 0.5em; + border-width: 1px; + border-style: solid; +} +.note h3, .warning h3 +{ + margin-top: 0.0em +} +.note p, .warning p +{ + margin-bottom: 0.0em +} + +/* blob links */ +h2 .extralinks, h3 .extralinks +{ + float: right; + /* tango:aluminium 3 */ + color: #babdb6; + font-size: 80%; + font-weight: normal; +} + +.annotation +{ + /* tango:aluminium 5 */ + color: #555753; + font-size: 80%; + font-weight: normal; +} + +/* code listings */ + +.listing_code .programlisting .cbracket { color: #a40000; } /* tango: scarlet red 3 */ +.listing_code .programlisting .comment { color: #a1a39d; } /* tango: aluminium 4 */ +.listing_code .programlisting .function { color: #000000; font-weight: bold; } +.listing_code .programlisting .function a { color: #11326b; font-weight: bold; } /* tango: sky blue 4 */ +.listing_code .programlisting .keyword { color: #4e9a06; } /* tango: chameleon 3 */ +.listing_code .programlisting .linenum { color: #babdb6; } /* tango: aluminium 3 */ +.listing_code .programlisting .normal { color: #000000; } +.listing_code .programlisting .number { color: #75507b; } /* tango: plum 2 */ +.listing_code .programlisting .preproc { color: #204a87; } /* tango: sky blue 3 */ +.listing_code .programlisting .string { color: #c17d11; } /* tango: chocolate 2 */ +.listing_code .programlisting .type { color: #000000; } +.listing_code .programlisting .type a { color: #11326b; } /* tango: sky blue 4 */ +.listing_code .programlisting .symbol { color: #ce5c00; } /* tango: orange 3 */ + +.listing_frame { + /* tango:sky blue 1 */ + border: solid 1px #729fcf; + padding: 0px; +} + +.listing_lines, .listing_code { + margin-top: 0px; + margin-bottom: 0px; + padding: 0.5em; +} +.listing_lines { + /* tango:sky blue 0.5 */ + background: #a6c5e3; + /* tango:aluminium 6 */ + color: #2e3436; +} +.listing_code { + /* tango:sky blue 0 */ + background: #e6f3ff; +} +.listing_code .programlisting { + /* override from previous */ + border: none 0px; + padding: 0px; +} +.listing_lines pre, .listing_code pre { + margin: 0px; +} + diff --git a/doc/reference/cogl-2.0-experimental/html/up.png b/doc/reference/cogl-2.0-experimental/html/up.png new file mode 100644 index 0000000..85b3e2a Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/html/up.png differ 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 0000000..a31d95d Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/quad-indices-order.png differ 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 0000000..18c42c8 Binary files /dev/null and b/doc/reference/cogl-2.0-experimental/quad-indices-triangles.png differ diff --git a/doc/reference/cogl/Makefile.am b/doc/reference/cogl/Makefile.am new file mode 100644 index 0000000..303b2e7 --- /dev/null +++ b/doc/reference/cogl/Makefile.am @@ -0,0 +1,153 @@ +## 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-handle.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..5e655fa --- /dev/null +++ b/doc/reference/cogl/Makefile.in @@ -0,0 +1,870 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/cogl-docs.xml.in $(top_srcdir)/gtk-doc.make +subdir = doc/reference/cogl +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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-handle.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 +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_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 +TAGS: + +ctags: CTAGS +CTAGS: + +@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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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@uninstall-local: +@BUILD_GTK_DOC_FALSE@distclean-local: +@BUILD_GTK_DOC_FALSE@install-data-local: +@BUILD_GTK_DOC_FALSE@maintainer-clean-local: +@BUILD_GTK_DOC_FALSE@clean-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 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 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 + +#### setup #### + +@BUILD_GTK_DOC_TRUE@setup-build.stamp: +@BUILD_GTK_DOC_TRUE@ -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ +@BUILD_GTK_DOC_TRUE@ echo ' DOC Preparing build'; \ +@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)/ || true; \ +@BUILD_GTK_DOC_TRUE@ done; \ +@BUILD_GTK_DOC_TRUE@ fi; \ +@BUILD_GTK_DOC_TRUE@ fi +@BUILD_GTK_DOC_TRUE@ @touch setup-build.stamp + +#### scan #### + +@BUILD_GTK_DOC_TRUE@scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) +@BUILD_GTK_DOC_TRUE@ @echo ' DOC Scanning header files' +@BUILD_GTK_DOC_TRUE@ @_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@ @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ +@BUILD_GTK_DOC_TRUE@ echo " DOC Introspecting gobjects"; \ +@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@ @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 + +#### xml #### + +@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@ @echo ' DOC Building XML' +@BUILD_GTK_DOC_TRUE@ @_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@ @touch sgml-build.stamp + +@BUILD_GTK_DOC_TRUE@sgml.stamp: sgml-build.stamp +@BUILD_GTK_DOC_TRUE@ @true + +#### html #### + +@BUILD_GTK_DOC_TRUE@html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ @echo ' DOC Building HTML' +@BUILD_GTK_DOC_TRUE@ @rm -rf html +@BUILD_GTK_DOC_TRUE@ @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@ @echo ' DOC Fixing cross-references' +@BUILD_GTK_DOC_TRUE@ @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) +@BUILD_GTK_DOC_TRUE@ @touch html-build.stamp + +#### pdf #### + +@BUILD_GTK_DOC_TRUE@pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +@BUILD_GTK_DOC_TRUE@ @echo ' DOC Building PDF' +@BUILD_GTK_DOC_TRUE@ @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@ @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: clean +@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: +@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..7cafc46 --- /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..60db06d --- /dev/null +++ b/doc/reference/cogl/cogl-sections.txt @@ -0,0 +1,710 @@ +
+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_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_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-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 0000000..2c2a1fd Binary files /dev/null and b/doc/reference/cogl/cogl_ortho.png differ 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 0000000..1e4fbb0 Binary files /dev/null and b/doc/reference/cogl/fill-rule-even-odd.png differ 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 0000000..2d8ad31 Binary files /dev/null and b/doc/reference/cogl/fill-rule-non-zero.png differ diff --git a/doc/reference/cogl/html/ch01.html b/doc/reference/cogl/html/ch01.html new file mode 100644 index 0000000..63e1880 --- /dev/null +++ b/doc/reference/cogl/html/ch01.html @@ -0,0 +1,91 @@ + + + + +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 — Fuctions 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 — Functions for constructing and drawing 2D paths. +
+
+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 — Fuctions for initializing and manipulating 4x4 matrices +
+
+Shaders and Programmable Pipeline — Fuctions for accessing the programmable GL pipeline +
+
+Offscreen Buffers — Fuctions for creating and manipulating offscreen + framebuffers. +
+
+Bitmaps — Fuctions 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..7718012 --- /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 — Fuctions 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..13d6c6f --- /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..f9f1fc6 --- /dev/null +++ b/doc/reference/cogl/html/cogl-3D-textures.html @@ -0,0 +1,249 @@ + + + + +3D textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

3D textures

+

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

+
+
+

Synopsis

+
CoglTexture3D *     cogl_texture_3d_new_with_size       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat internal_format,
+                                                         GError **error);
+CoglTexture3D *     cogl_texture_3d_new_from_data       (CoglContext *context,
+                                                         int width,
+                                                         int height,
+                                                         int depth,
+                                                         CoglPixelFormat format,
+                                                         CoglPixelFormat internal_format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const guint8 *data,
+                                                         GError **error);
+gboolean            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,
+                                                         CoglPixelFormat internal_format,
+                                                         GError **error);
+

+Creates a new Cogl 3D texture with the specified dimensions and +pixel format. +

+

+Note that this function will throw a GError if +COGL_FEATURE_TEXTURE_3D is not advertised. It 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.

internal_format :

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

error :

A GError return location.

Returns :

a new CoglTexture3D object or +NULL on failure and an exception will be returned +in error.
+

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,
+                                                         CoglPixelFormat internal_format,
+                                                         int rowstride,
+                                                         int image_stride,
+                                                         const guint8 *data,
+                                                         GError **error);
+

+Creates a new 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 that this function will throw a GError if +COGL_FEATURE_TEXTURE_3D is not advertised. It 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.

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 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 GError return location.

Returns :

the newly created CoglTexture3D or NULL if +there was an error an an exception will be returned +through error.
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_texture_3d ()

+
gboolean            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..979b101 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Bitmaps.html @@ -0,0 +1,211 @@ + + + + +Bitmaps + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Bitmaps

+

Bitmaps — Fuctions for loading images

+
+
+

Synopsis

+
                    CoglBitmap;
+CoglBitmap *        cogl_bitmap_new_from_file           (const char *filename,
+                                                         GError **error);
+gboolean            cogl_bitmap_get_size_from_file      (const char *filename,
+                                                         int *width,
+                                                         int *height);
+gboolean            cogl_is_bitmap                      (CoglHandle handle);
+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,
+                                                         GError **error);
+

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

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

filename :

the file to load.

error :

a GError or NULL.

Returns :

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

Since 1.0

+
+
+
+

cogl_bitmap_get_size_from_file ()

+
gboolean            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 ()

+
gboolean            cogl_is_bitmap                      (CoglHandle handle);
+

+Checks whether handle is a CoglHandle for a bitmap +

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

handle :

a CoglHandle for a bitmap

Returns :

+TRUE if the passed handle 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 ())
+
+

+GError 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..ee6c8c2 --- /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..e60da59 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Buffers.html @@ -0,0 +1,430 @@ + + + + +Buffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Buffers

+

Buffers — Common buffer functions, including data upload APIs

+
+
+

Stability Level

+Unstable, unless otherwise indicated +
+
+

Synopsis

+
gboolean            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);
+gboolean            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         gsize offset,
+                                                         const void *data,
+                                                         gsize size);
+
+#define             cogl_pixel_buffer_new
+#define             cogl_is_pixel_buffer
+
+
+
+

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 ()

+
gboolean            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. +

+

+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
+

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 ()

+
gboolean            cogl_buffer_set_data                (CoglBuffer *buffer,
+                                                         gsize offset,
+                                                         const void *data,
+                                                         gsize 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

+
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP
+
+

+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
+

Since 1.10

+

Stability Level: Unstable

+
+
+
+

cogl_is_pixel_buffer

+
#define cogl_is_pixel_buffer cogl_is_pixel_buffer_EXP
+
+

+Checks whether handle is a pixel array. +

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

object :

a CoglObject to test

Returns :

+TRUE if the handle is a pixel array, 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..da594b1 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Clipping-(Deprecated).html @@ -0,0 +1,210 @@ + + + + +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.2 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_clip_push_rectangle() + 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(). +

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

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.2 and should not be used in newly-written code. Use cogl_clip_push_window_rectangle() 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..db81aae --- /dev/null +++ b/doc/reference/cogl/html/cogl-Clipping.html @@ -0,0 +1,184 @@ + + + + +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_push_from_path            (void);
+void                cogl_clip_push_from_path_preserve   (void);
+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);
+

+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);
+

+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_push_from_path ()

+
void                cogl_clip_push_from_path            (void);
+

+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

+

Stability Level: Unstable

+
+
+
+

cogl_clip_push_from_path_preserve ()

+
void                cogl_clip_push_from_path_preserve   (void);
+

+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

+
+
+
+

cogl_clip_pop ()

+
void                cogl_clip_pop                       (void);
+

+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..9939c0f --- /dev/null +++ b/doc/reference/cogl/html/cogl-Color-Type.html @@ -0,0 +1,1027 @@ + + + + +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,
+                                                         float *color_array);
+void                cogl_color_init_from_4ub            (CoglColor *color,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 alpha);
+void                cogl_color_set_from_4ub             (CoglColor *color,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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);
+gboolean            cogl_color_equal                    (gconstpointer v1,
+                                                         gconstpointer v2);
+
+
+
+

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,
+                                                         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,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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 ()

+
gboolean            cogl_color_equal                    (gconstpointer v1,
+                                                         gconstpointer 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

+
+
+
+ + + \ 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..2ad82dd --- /dev/null +++ b/doc/reference/cogl/html/cogl-Fixed-Point-API.html @@ -0,0 +1,1186 @@ + + + + +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 gint32 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
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 < 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. +

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

x :

integer value

Returns :

integer square root.
+

Since 0.2

+
+
+
+

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 gint32 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..43bec70 --- /dev/null +++ b/doc/reference/cogl/html/cogl-GType-Integration-API.html @@ -0,0 +1,67 @@ + + + + +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);
+
++ + + + +

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..53633eb --- /dev/null +++ b/doc/reference/cogl/html/cogl-General-API-(Deprecated).html @@ -0,0 +1,218 @@ + + + + +General API (Deprecated) + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

General API (Deprecated)

+

General API (Deprecated)

+
+
+

Synopsis

+
gboolean            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         (gboolean setting);
+gboolean            cogl_get_depth_test_enabled         (void);
+
+
+
+

Description

+
+
+

Details

+
+

cogl_check_extension ()

+
gboolean            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
gboolean 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.2 and should not be used in newly-written code. Use cogl_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);
+

+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         (gboolean setting);
+
+

Warning

+

cogl_set_depth_test_enabled has been deprecated since version 1.4 and should not be used in newly-written code. Use cogl_material_set_depth_test_enabled() +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 ()

+
gboolean            cogl_get_depth_test_enabled         (void);
+
+

Warning

+

cogl_get_depth_test_enabled has been deprecated since version 1.4 and should not be used in newly-written code. Use cogl_material_get_depth_test_enabled() +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..b9df2a8 --- /dev/null +++ b/doc/reference/cogl/html/cogl-General-API.html @@ -0,0 +1,2003 @@ + + + + +General API + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

General API

+

General API — General purpose API

+
+
+

Synopsis

+
                    CoglObject;
+void *              cogl_object_ref                     (void *object);
+void                cogl_object_unref                   (void *object);
+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);
+gboolean            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   (gboolean setting);
+gboolean            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            (guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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,
+                                                         guint8 *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;
+
+
+
+

cogl_object_ref ()

+
void *              cogl_object_ref                     (void *object);
+

+Increases the reference count of handle 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 +
+
+
+
+

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 gpointer 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_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)
+} 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_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 +
+

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)
+} 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

+

Since 0.8

+
+
+
+

cogl_get_features ()

+
CoglFeatureFlags    cogl_get_features                   (void);
+

+Returns all of the features supported by COGL. +

+
++ + + + +

Returns :

A logical OR of all the supported COGL features.
+

Since 0.8

+
+
+
+

cogl_features_available ()

+
gboolean            cogl_features_available             (CoglFeatureFlags features);
+

+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. +

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

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);
+

+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);
+

+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);
+

+Restores the current model-view matrix from the matrix stack. +

+
+
+
+

cogl_scale ()

+
void                cogl_scale                          (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. +

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

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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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]);
+

+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);
+

+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   (gboolean setting);
+

+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 ()

+
gboolean            cogl_get_backface_culling_enabled   (void);
+

+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
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
f = end - eye_distance / end - start
+
+ +

COGL_FOG_MODE_EXPONENTIAL

Calculates the fog blend factor as: +
+ + + + + + + +
1
f = e ^ -(density * eye_distance)
+
+ +

COGL_FOG_MODE_EXPONENTIAL_SQUARED

Calculates the fog blend factor as: +
+ + + + + + + +
1
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);
+

+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);
+

+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);
+

+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);
+

+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            (guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 alpha);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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_read_pixels() +

+
++ + + + +

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,
+                                                         guint8 *pixels);
+

+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);
+

+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
{
+   - 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
{
+   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
{
+   - 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);
+

+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..9c2eb1c --- /dev/null +++ b/doc/reference/cogl/html/cogl-Materials-(Deprecated).html @@ -0,0 +1,144 @@ + + + + +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);
+

+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..b29cbe7 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Materials.html @@ -0,0 +1,2119 @@ + + + + +Materials + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Materials

+

Materials — Fuctions for creating and manipulating materials

+
+
+

Synopsis

+
                    CoglMaterial;
+                    CoglMaterialLayer;
+gboolean            (*CoglMaterialLayerCallback)        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         void *user_data);
+CoglMaterial *      cogl_material_new                   (void);
+CoglMaterial *      cogl_material_copy                  (CoglMaterial *source);
+gboolean            cogl_is_material                    (CoglHandle handle);
+void                cogl_material_set_color             (CoglMaterial *material,
+                                                         const CoglColor *color);
+void                cogl_material_set_color4ub          (CoglMaterial *material,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 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;
+gboolean            cogl_material_set_blend             (CoglMaterial *material,
+                                                         const char *blend_string,
+                                                         GError **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);
+gboolean            cogl_material_set_layer_combine     (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         GError **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);
+gboolean            cogl_material_set_layer_point_sprite_coords_enabled
+                                                        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         gboolean enable,
+                                                         GError **error);
+gboolean            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 ()

+
gboolean            (*CoglMaterialLayerCallback)        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         void *user_data);
+

+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);
+

+Allocates and initializes a blank white material +

+
++ + + + +

Returns :

a pointer to a new CoglMaterial +
+
+
+
+

cogl_material_copy ()

+
CoglMaterial *      cogl_material_copy                  (CoglMaterial *source);
+

+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 ()

+
gboolean            cogl_is_material                    (CoglHandle handle);
+

+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);
+

+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,
+                                                         guint8 red,
+                                                         guint8 green,
+                                                         guint8 blue,
+                                                         guint8 alpha);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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 ())
+
+

+GError 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 ()

+
gboolean            cogl_material_set_blend             (CoglMaterial *material,
+                                                         const char *blend_string,
+                                                         GError **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
<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
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 GError 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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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 ()

+
gboolean            cogl_material_set_layer_combine     (CoglMaterial *material,
+                                                         int layer_index,
+                                                         const char *blend_string,
+                                                         GError **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_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
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
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 GError 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);
+

+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);
+

+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 ()

+
gboolean            cogl_material_set_layer_point_sprite_coords_enabled
+                                                        (CoglMaterial *material,
+                                                         int layer_index,
+                                                         gboolean enable,
+                                                         GError **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_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 GError, or NULL to ignore errors.

Returns :

+TRUE if the function succeeds, FALSE otherwise.
+

Since 1.4

+
+
+
+

cogl_material_get_layer_point_sprite_coords_enabled ()

+
gboolean            cogl_material_get_layer_point_sprite_coords_enabled
+                                                        (CoglMaterial *material,
+                                                         int layer_index);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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
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);
+

+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);
+

+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..c0dcbb9 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Matrices.html @@ -0,0 +1,997 @@ + + + + +Matrices + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Matrices

+

Matrices — Fuctions for initializing and manipulating 4x4 matrices

+
+
+

Synopsis

+
                    CoglMatrix;
+void                cogl_matrix_init_identity           (CoglMatrix *matrix);
+CoglMatrix *        cogl_matrix_copy                    (const CoglMatrix *matrix);
+gboolean            cogl_matrix_equal                   (gconstpointer v1,
+                                                         gconstpointer 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);
+gboolean            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);
+gboolean            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
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
.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() +
+

Since 1.6

+
+
+
+

cogl_matrix_equal ()

+
gboolean            cogl_matrix_equal                   (gconstpointer v1,
+                                                         gconstpointer 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 ()

+
gboolean            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
typedef struct {
+  float x,y;
+  guint8 r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  guint8 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
typedef struct {
+  float x,y;
+  guint8 r,g,b,a;
+  float s,t,p;
+} MyInVertex;
+typedef struct {
+  guint8 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 ()

+
gboolean            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..8948000 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Offscreen-Buffers-(Deprecated).html @@ -0,0 +1,101 @@ + + + + +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..26101c6 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Offscreen-Buffers.html @@ -0,0 +1,356 @@ + + + + +Offscreen Buffers + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Offscreen Buffers

+

Offscreen Buffers — Fuctions for creating and manipulating offscreen + framebuffers.

+
+
+

Synopsis

+
CoglOffscreen *     cogl_offscreen_new_to_texture       (CoglTexture *texture);
+gboolean            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_to_texture ()

+
CoglOffscreen *     cogl_offscreen_new_to_texture       (CoglTexture *texture);
+

+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 ()

+
gboolean            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);
+

+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);
+

+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
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);
+

+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.2 and should not be used in newly-written code. The target argument was redundant since we could look at + the type of CoglHandle given instead.

+
+

+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.2 and should not be used in newly-written code. The draw buffer API was replaced with a framebuffer API

+
+

+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.2 and should not be used in newly-written code. The draw buffer API was replaced with a framebuffer API

+
+

+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..f58ec68 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Path-Primitives.html @@ -0,0 +1,861 @@ + + + + +Path Primitives + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Path Primitives

+

Path Primitives — Functions for constructing and drawing 2D paths.

+
+
+

Synopsis

+
gboolean            cogl_is_path                        (CoglHandle handle);
+void                cogl_path_new                       (void);
+CoglPath *          cogl_get_path                       (void);
+void                cogl_set_path                       (CoglPath *path);
+CoglPath *          cogl_path_copy                      (CoglPath *path);
+void                cogl_path_move_to                   (float x,
+                                                         float y);
+void                cogl_path_close                     (void);
+void                cogl_path_line_to                   (float x,
+                                                         float y);
+void                cogl_path_curve_to                  (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+void                cogl_path_arc                       (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y,
+                                                         float angle_1,
+                                                         float angle_2);
+void                cogl_path_rel_move_to               (float x,
+                                                         float y);
+void                cogl_path_rel_line_to               (float x,
+                                                         float y);
+void                cogl_path_rel_curve_to              (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+void                cogl_path_line                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_path_polyline                  (const float *coords,
+                                                         int num_points);
+void                cogl_path_polygon                   (const float *coords,
+                                                         int num_points);
+void                cogl_path_rectangle                 (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+void                cogl_path_round_rectangle           (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float radius,
+                                                         float arc_step);
+void                cogl_path_ellipse                   (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y);
+
+enum                CoglPathFillRule;
+void                cogl_path_set_fill_rule             (CoglPathFillRule fill_rule);
+CoglPathFillRule    cogl_path_get_fill_rule             (void);
+void                cogl_path_fill                      (void);
+void                cogl_path_fill_preserve             (void);
+void                cogl_path_stroke                    (void);
+void                cogl_path_stroke_preserve           (void);
+
+
+
+

Description

+

+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. +

+
+
+

Details

+
+

cogl_is_path ()

+
gboolean            cogl_is_path                        (CoglHandle handle);
+

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

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

object :

A CoglObject +

Returns :

+TRUE if the object references a CoglPath, +FALSE otherwise.
+

Since 2.0

+
+
+
+

cogl_path_new ()

+
void                cogl_path_new                       (void);
+

+Creates a new, empty path object. The default fill rule is +COGL_PATH_FILL_RULE_EVEN_ODD. +

+
++ + + + +

Returns :

A pointer to a newly allocated CoglPath, which can +be freed using cogl_object_unref().
+

Since 2.0

+
+
+
+

cogl_get_path ()

+
CoglPath *          cogl_get_path                       (void);
+

+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(). +

+
++ + + + +

Returns :

a pointer to the current path.
+

Since 1.4

+
+
+
+

cogl_set_path ()

+
void                cogl_set_path                       (CoglPath *path);
+

+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(). +

+
++ + + + +

path :

A CoglPath object
+

Since 1.4

+
+
+
+

cogl_path_copy ()

+
CoglPath *          cogl_path_copy                      (CoglPath *path);
+

+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. +

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

path :

A CoglPath object

Returns :

a copy of the path in path.
+

Since 2.0

+
+
+
+

cogl_path_move_to ()

+
void                cogl_path_move_to                   (float x,
+                                                         float y);
+

+Moves the pen to the given location. If there is an existing path +this will start a new disjoint subpath. +

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

x :

X coordinate of the pen location to move to.

y :

Y coordinate of the pen location to move to.
+

Since 2.0

+
+
+
+

cogl_path_close ()

+
void                cogl_path_close                     (void);
+

+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

+
+
+
+

cogl_path_line_to ()

+
void                cogl_path_line_to                   (float x,
+                                                         float y);
+

+Adds a straight line segment to the current path that ends at the +given coordinates. +

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

x :

X coordinate of the end line vertex

y :

Y coordinate of the end line vertex
+

Since 2.0

+
+
+
+

cogl_path_curve_to ()

+
void                cogl_path_curve_to                  (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+

+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. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_arc ()

+
void                cogl_path_arc                       (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y,
+                                                         float angle_1,
+                                                         float angle_2);
+

+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). +

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

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
+

Since 2.0

+
+
+
+

cogl_path_rel_move_to ()

+
void                cogl_path_rel_move_to               (float x,
+                                                         float y);
+

+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. +

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

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.
+

Since 2.0

+
+
+
+

cogl_path_rel_line_to ()

+
void                cogl_path_rel_line_to               (float x,
+                                                         float y);
+

+Adds a straight line segment to the current path that ends at the +given coordinates relative to the current pen location. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_rel_curve_to ()

+
void                cogl_path_rel_curve_to              (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float x_3,
+                                                         float y_3);
+

+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. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_line ()

+
void                cogl_path_line                      (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+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. +

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

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
+

Since 2.0

+
+
+
+

cogl_path_polyline ()

+
void                cogl_path_polyline                  (const float *coords,
+                                                         int num_points);
+

+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. +

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

coords :

A pointer to the first element of an +array of fixed-point values that specify the vertex coordinates. [in][array][transfer none] +

num_points :

The total number of vertices.
+

Since 2.0

+
+
+
+

cogl_path_polygon ()

+
void                cogl_path_polygon                   (const float *coords,
+                                                         int num_points);
+

+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. +

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

coords :

A pointer to the first element of +an array of fixed-point values that specify the vertex coordinates. [in][array][transfer none] +

num_points :

The total number of vertices.
+

Since 2.0

+
+
+
+

cogl_path_rectangle ()

+
void                cogl_path_rectangle                 (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2);
+

+Constructs a rectangular shape at the given coordinates. If there +is an existing path this will start a new disjoint sub-path. +

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

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 2.0

+
+
+
+

cogl_path_round_rectangle ()

+
void                cogl_path_round_rectangle           (float x_1,
+                                                         float y_1,
+                                                         float x_2,
+                                                         float y_2,
+                                                         float radius,
+                                                         float arc_step);
+

+Constructs a rectangular shape with rounded corners. If there is an +existing path this will start a new disjoint sub-path. +

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

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.
+

Since 2.0

+
+
+
+

cogl_path_ellipse ()

+
void                cogl_path_ellipse                   (float center_x,
+                                                         float center_y,
+                                                         float radius_x,
+                                                         float radius_y);
+

+Constructs an ellipse shape. If there is an existing path this will +start a new disjoint sub-path. +

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

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
+

Since 2.0

+
+
+
+

enum CoglPathFillRule

+
typedef enum {
+  COGL_PATH_FILL_RULE_NON_ZERO,
+  COGL_PATH_FILL_RULE_EVEN_ODD
+} CoglPathFillRule;
+
+

+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 is COGL_PATH_FILL_RULE_EVEN_ODD. The fill +rule is attached to the current path so preserving a path with +cogl_get_path() also preserves the fill rule. Calling +cogl_path_new() resets the current fill rule to the default. +

+

+

+
+

Figure 2. Example of filling various paths using the non-zero rule

+
Example of filling various paths using the non-zero rule
+
+


+

+

+

+
+

Figure 3. Example of filling various paths using the even-odd rule

+
Example of filling various paths using the even-odd rule
+
+


+

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

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 Figure 2, “Example of filling various paths using the non-zero rule”. +

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 Figure 3, “Example of filling various paths using the even-odd rule”. +
+

Since 1.4

+
+
+
+

cogl_path_set_fill_rule ()

+
void                cogl_path_set_fill_rule             (CoglPathFillRule 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. +

+
++ + + + +

fill_rule :

The new fill rule.
+

Since 2.0

+
+
+
+

cogl_path_get_fill_rule ()

+
CoglPathFillRule    cogl_path_get_fill_rule             (void);
+

+Retrieves the fill rule set using cogl_path_set_fill_rule(). +

+
++ + + + +

Returns :

the fill rule that is used for the current path.
+

Since 2.0

+
+
+
+

cogl_path_fill ()

+
void                cogl_path_fill                      (void);
+

+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. +

+

+

+
+

Note

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

+
+
+
+

cogl_path_fill_preserve ()

+
void                cogl_path_fill_preserve             (void);
+

+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

+
+
+
+

cogl_path_stroke ()

+
void                cogl_path_stroke                    (void);
+

+Strokes the constructed shape using the current drawing color and a +width of 1 pixel (regardless of the current transformation +matrix). +

+

Since 2.0

+
+
+
+

cogl_path_stroke_preserve ()

+
void                cogl_path_stroke_preserve           (void);
+

+Strokes the constructed shape using the current drawing color and +preserves the path to be used again. +

+

Since 1.0

+
+
+
+ + + \ 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..3f44597 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Primitives.html @@ -0,0 +1,342 @@ + + + + +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,
+                                                         gboolean 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,
+                                                         gboolean 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..873cc5d --- /dev/null +++ b/doc/reference/cogl/html/cogl-Quaternions-(Rotations).html @@ -0,0 +1,773 @@ + + + + +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);
+gboolean            cogl_quaternion_equal               (gconstpointer v1,
+                                                         gconstpointer 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. +(http://en.wikipedia.org/wiki/Gimbal_lock). +

+
+
+

Details

+
+

CoglQuaternion

+
typedef struct {
+  float w;
+
+  float x;
+  float y;
+  float z;
+
+  float padding0;
+  float padding1;
+  float padding2;
+  float padding3;
+} 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 <pre>[w (x, y, z)]</pre>. +

+

+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
[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
sqrt (w² + x² + y² + z²)
+
+ +

+and a unit quaternion satisfies this equation: +

+
+ + + + + + + +
1
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: +

+

+

+ +

+

+

+@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 +

+
+
+
+

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 +

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 (x,y,z),w
+

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 y axis
+

Since 2.0

+
+
+
+

cogl_quaternion_equal ()

+
gboolean            cogl_quaternion_equal               (gconstpointer v1,
+                                                         gconstpointer 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 +
+

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. +

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

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 +
+

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() +
  • +
+

+

+
+
+
+

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);
+

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..01c16a2 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline-(Deprecated).html @@ -0,0 +1,362 @@ + + + + +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,
+                                                         gboolean 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.0 and should not be used in newly-written code. Please use cogl_handle_ref() instead.

+
+

+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.0 and should not be used in newly-written code. Please use cogl_handle_unref() instead.

+
+

+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.0 and should not be used in newly-written code. Please use cogl_handle_ref() instead.

+
+

+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.0 and should not be used in newly-written code. Please use cogl_handle_unref() instead.

+
+

+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);
+

+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.4 and should not be used in newly-written code. Use cogl_program_set_uniform_1f() instead.

+
+

+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.4 and should not be used in newly-written code. Use cogl_program_set_uniform_1i() instead.

+
+

+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.4 and should not be used in newly-written code. Use cogl_program_set_uniform_float() instead.

+
+

+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 is deprecated and should not be used in newly-written code.

+
+

+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,
+                                                         gboolean transpose,
+                                                         const float *value);
+
+

Warning

+

cogl_program_uniform_matrix is deprecated and should not be used in newly-written code.

+
+

+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..69b49ee --- /dev/null +++ b/doc/reference/cogl/html/cogl-Shaders-and-Programmable-Pipeline.html @@ -0,0 +1,766 @@ + + + + +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);
+gboolean            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);
+gboolean            cogl_shader_is_compiled             (CoglHandle handle);
+
+CoglHandle          cogl_create_program                 (void);
+gboolean            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,
+                                                         gboolean 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);
+

+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 ()

+
gboolean            cogl_is_shader                      (CoglHandle handle);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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 ()

+
gboolean            cogl_shader_is_compiled             (CoglHandle handle);
+

+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);
+

+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 ()

+
gboolean            cogl_is_program                     (CoglHandle handle);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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,
+                                                         gboolean transpose,
+                                                         const float *value);
+

+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..b0c28c9 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Textures-(Deprecated).html @@ -0,0 +1,98 @@ + + + + +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..02e40d0 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Textures.html @@ -0,0 +1,816 @@ + + + + +Textures + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

Textures

+

Textures — Fuctions 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,
+                                                         GError **error);
+CoglTexture *       cogl_texture_new_from_data          (unsigned int width,
+                                                         unsigned int height,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat format,
+                                                         CoglPixelFormat internal_format,
+                                                         unsigned int rowstride,
+                                                         const guint8 *data);
+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);
+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);
+gboolean            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);
+gboolean            cogl_texture_is_sliced              (CoglTexture *texture);
+gboolean            cogl_texture_get_gl_texture         (CoglTexture *texture,
+                                                         GLuint *out_gl_handle,
+                                                         GLenum *out_gl_target);
+int                 cogl_texture_get_data               (CoglTexture *texture,
+                                                         CoglPixelFormat format,
+                                                         unsigned int rowstride,
+                                                         guint8 *data);
+gboolean            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 guint8 *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);
+

+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
+

Since 0.8

+
+
+
+

cogl_texture_new_from_file ()

+
CoglTexture *       cogl_texture_new_from_file          (const char *filename,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat internal_format,
+                                                         GError **error);
+

+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 GError or NULL +

Returns :

A newly created CoglTexture or NULL on failure
+

Since 0.8

+
+
+
+

cogl_texture_new_from_data ()

+
CoglTexture *       cogl_texture_new_from_data          (unsigned int width,
+                                                         unsigned int height,
+                                                         CoglTextureFlags flags,
+                                                         CoglPixelFormat format,
+                                                         CoglPixelFormat internal_format,
+                                                         unsigned int rowstride,
+                                                         const guint8 *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
+

Since 0.8

+
+
+
+

cogl_texture_new_from_foreign ()

+
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);
+

+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
+

Since 0.8

+
+
+
+

cogl_texture_new_from_bitmap ()

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

+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
+

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);
+

+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
+

Since 1.2

+
+
+
+

cogl_is_texture ()

+
gboolean            cogl_is_texture                     (void *object);
+

+Gets whether the given object references a texture object. +

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

object :

A CoglObject pointer

Returns :

+TRUE if the handle 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. +

+
++ + + + +

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. +

+
++ + + + +

Returns :

the height of the GPU side texture in pixels
+
+
+
+

cogl_texture_get_format ()

+
CoglPixelFormat     cogl_texture_get_format             (CoglTexture *texture);
+

+Queries the CoglPixelFormat of a cogl texture. +

+
++ + + + +

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. +

+
++ + + + +

Returns :

the maximum waste
+
+
+
+

cogl_texture_is_sliced ()

+
gboolean            cogl_texture_is_sliced              (CoglTexture *texture);
+

+Queries if a texture is sliced (stored as multiple GPU side tecture +objects). +

+
++ + + + +

Returns :

+TRUE if the texture is sliced, FALSE if the texture +is stored as a single GPU texture
+
+
+
+

cogl_texture_get_gl_texture ()

+
gboolean            cogl_texture_get_gl_texture         (CoglTexture *texture,
+                                                         GLuint *out_gl_handle,
+                                                         GLenum *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. +

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

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,
+                                                         guint8 *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
+

+

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

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 ()

+
gboolean            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 guint8 *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 +
+

+

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

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..fd92319 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Vectors.html @@ -0,0 +1,602 @@ + + + + +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);
+gboolean            cogl_vector3_equal                  (gconstpointer v1,
+                                                         gconstpointer v2);
+gboolean            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 ()

+
gboolean            cogl_vector3_equal                  (gconstpointer v1,
+                                                         gconstpointer 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 ()

+
gboolean            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
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_vector_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. +

+
++ + + + +

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
(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
|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..6751e14 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Vertex-Buffers-(Deprecated).html @@ -0,0 +1,98 @@ + + + + +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_handle_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_handle_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..ad4f582 --- /dev/null +++ b/doc/reference/cogl/html/cogl-Vertex-Buffers.html @@ -0,0 +1,719 @@ + + + + +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,
+                                                         guint8 n_components,
+                                                         CoglAttributeType type,
+                                                         gboolean normalized,
+                                                         guint16 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);
+gboolean            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);
+gboolean            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);
+

+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);
+

+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,
+                                                         guint8 n_components,
+                                                         CoglAttributeType type,
+                                                         gboolean normalized,
+                                                         guint16 stride,
+                                                         const void *pointer);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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);
+

+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 ()

+
gboolean            cogl_is_vertex_buffer               (CoglHandle handle);
+

+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_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);
+

+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);
+

+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);
+

+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 4, “Example of vertices submitted to form a quad” then you can request 6 +indices to render two triangles like those shown in Figure 5, “Illustration of the triangle indices that will be generated”. +

+

+

+
+

Figure 4. Example of vertices submitted to form a quad

+
Example of vertices submitted to form a quad
+
+


+

+

+

+
+

Figure 5. 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 ()

+
gboolean            cogl_is_vertex_buffer_indices       (CoglHandle handle);
+

+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..396d5f5 --- /dev/null +++ b/doc/reference/cogl/html/cogl.devhelp2 @@ -0,0 +1,582 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl/html/cogl_ortho.png b/doc/reference/cogl/html/cogl_ortho.png new file mode 100644 index 0000000..2c2a1fd Binary files /dev/null and b/doc/reference/cogl/html/cogl_ortho.png differ diff --git a/doc/reference/cogl/html/coglglossary.html b/doc/reference/cogl/html/coglglossary.html new file mode 100644 index 0000000..d962372 --- /dev/null +++ b/doc/reference/cogl/html/coglglossary.html @@ -0,0 +1,67 @@ + + + + +Glossaries + + + + + + + + + + + + + + + + +
+

+Glossaries

+ +
+

+Annotation Glossary

+

O

+
+out
+

Parameter for returning results. Default is transfer full.

+

A

+
+allow-none
+

NULL is ok, both for passing and for returning.

+

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.

+

A

+
+array
+

Parameter points to an array of items.

+

E

+
+element-type
+

Generics and defining elements of containers and arrays.

+

I

+
+in
+

Parameter for input. Default is transfer none.

+

T

+
+transfer full
+

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 0000000..1e4fbb0 Binary files /dev/null and b/doc/reference/cogl/html/fill-rule-even-odd.png differ 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 0000000..2d8ad31 Binary files /dev/null and b/doc/reference/cogl/html/fill-rule-non-zero.png differ diff --git a/doc/reference/cogl/html/home.png b/doc/reference/cogl/html/home.png new file mode 100644 index 0000000..1700361 Binary files /dev/null and b/doc/reference/cogl/html/home.png differ diff --git a/doc/reference/cogl/html/index.html b/doc/reference/cogl/html/index.html new file mode 100644 index 0000000..8d63347 --- /dev/null +++ b/doc/reference/cogl/html/index.html @@ -0,0 +1,158 @@ + + + + +Cogl Reference Manual + + + + + + + +
+
+
+
+

for Cogl 1.10.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 — Fuctions 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 — Functions for constructing and drawing 2D paths. +
+
+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 — Fuctions for initializing and manipulating 4x4 matrices +
+
+Shaders and Programmable Pipeline — Fuctions for accessing the programmable GL pipeline +
+
+Offscreen Buffers — Fuctions for creating and manipulating offscreen + framebuffers. +
+
+Bitmaps — Fuctions 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 — Fuctions 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..ca6f33f --- /dev/null +++ b/doc/reference/cogl/html/index.sgml @@ -0,0 +1,638 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/reference/cogl/html/ix01.html b/doc/reference/cogl/html/ix01.html new file mode 100644 index 0000000..b1ca6a1 --- /dev/null +++ b/doc/reference/cogl/html/ix01.html @@ -0,0 +1,1812 @@ + + + + +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_from_path, function in Clipping +
+
+
+cogl_clip_push_from_path_preserve, function in Clipping +
+
+
+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_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_unpremultiply, function in Color Type +
+
+
+cogl_create_program, function in Shaders and Programmable Pipeline +
+
+
+cogl_create_shader, function in Shaders and Programmable Pipeline +
+
+

D

+
+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, 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, function 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_path, function in Path Primitives +
+
+
+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_path, function in Path Primitives +
+
+
+cogl_is_pixel_buffer, macro 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, macro 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_ref, function in Offscreen Buffers (Deprecated) +
+
+
+cogl_offscreen_unref, function in Offscreen Buffers (Deprecated) +
+
+
+cogl_ortho, function in General API +
+
+

P

+
+CoglPathFillRule, enum in Path Primitives +
+
+
+cogl_path_arc, function in Path Primitives +
+
+
+cogl_path_close, function in Path Primitives +
+
+
+cogl_path_copy, function in Path Primitives +
+
+
+cogl_path_curve_to, function in Path Primitives +
+
+
+cogl_path_ellipse, function in Path Primitives +
+
+
+cogl_path_fill, function in Path Primitives +
+
+
+cogl_path_fill_preserve, function in Path Primitives +
+
+
+cogl_path_get_fill_rule, function in Path Primitives +
+
+
+cogl_path_line, function in Path Primitives +
+
+
+cogl_path_line_to, function in Path Primitives +
+
+
+cogl_path_move_to, function in Path Primitives +
+
+
+cogl_path_new, function in Path Primitives +
+
+
+cogl_path_polygon, function in Path Primitives +
+
+
+cogl_path_polyline, function in Path Primitives +
+
+
+cogl_path_rectangle, function in Path Primitives +
+
+
+cogl_path_rel_curve_to, function in Path Primitives +
+
+
+cogl_path_rel_line_to, function in Path Primitives +
+
+
+cogl_path_rel_move_to, function in Path Primitives +
+
+
+cogl_path_round_rectangle, function in Path Primitives +
+
+
+cogl_path_set_fill_rule, function in Path Primitives +
+
+
+cogl_path_stroke, function in Path Primitives +
+
+
+cogl_path_stroke_preserve, function in Path Primitives +
+
+
+cogl_perspective, function in General API +
+
+
+CoglPixelFormat, enum in General API +
+
+
+cogl_pixel_buffer_new, macro 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_path, function in Path Primitives +
+
+
+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_new_from_data, macro in 2D textures +
+
+
+cogl_texture_2d_new_from_foreign, macro in 2D textures +
+
+
+cogl_texture_2d_new_with_size, macro 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 +
+
+

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..3b2b427 --- /dev/null +++ b/doc/reference/cogl/html/ix02.html @@ -0,0 +1,189 @@ + + + + +Index of deprecated symbols + + + + + + + + + + + + + + + + + + + +
+

+Index of deprecated symbols

+

C

+
+cogl_check_extension, function in General API (Deprecated) +
+
+
+cogl_clip_ensure, function in Clipping (Deprecated) +
+
+
+cogl_clip_push, function in Clipping (Deprecated) +
+
+
+cogl_clip_push_window_rect, function in Clipping (Deprecated) +
+
+
+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 +
+
+

G

+
+cogl_get_depth_test_enabled, function in General API (Deprecated) +
+
+

M

+
+cogl_material_ref, function in Materials (Deprecated) +
+
+
+cogl_material_unref, function in Materials (Deprecated) +
+
+
+cogl_matrix_ortho, function in Matrices +
+
+

O

+
+cogl_offscreen_ref, function in Offscreen Buffers (Deprecated) +
+
+
+cogl_offscreen_unref, function in Offscreen Buffers (Deprecated) +
+
+

P

+
+cogl_pop_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_program_ref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+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_push_draw_buffer, function in Offscreen Buffers +
+
+

S

+
+cogl_set_depth_test_enabled, function in General API (Deprecated) +
+
+
+cogl_set_draw_buffer, function in Offscreen Buffers +
+
+
+cogl_shader_ref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+
+cogl_shader_unref, function in Shaders and Programmable Pipeline (Deprecated) +
+
+

T

+
+cogl_texture_get_rowstride, function in Textures +
+
+
+cogl_texture_ref, function in Textures (Deprecated) +
+
+
+cogl_texture_unref, function in Textures (Deprecated) +
+
+

V

+
+cogl_vertex_buffer_ref, function in Vertex Buffers (Deprecated) +
+
+
+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..a0eb51f --- /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..1f41326 --- /dev/null +++ b/doc/reference/cogl/html/ix04.html @@ -0,0 +1,619 @@ + + + + +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) +
+
+
+cogl_clip_push_from_path, function in Clipping +
+
+
+cogl_clip_push_from_path_preserve, function in Clipping +
+
+
+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_path_fill_preserve, function in Path Primitives +
+
+
+cogl_path_stroke_preserve, function in Path Primitives +
+
+
+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_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..c922de9 --- /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, macro 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..c5c2ffa --- /dev/null +++ b/doc/reference/cogl/html/ix06.html @@ -0,0 +1,307 @@ + + + + +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 +
+
+

G

+
+cogl_get_path, function in Path Primitives +
+
+

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

+
+CoglPathFillRule, enum in Path Primitives +
+
+
+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 +
+
+

S

+
+cogl_set_path, function in Path Primitives +
+
+

T

+
+cogl_transform, function 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..39f5a3c --- /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..0153bf5 --- /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 0000000..2d05b3d Binary files /dev/null and b/doc/reference/cogl/html/left.png differ diff --git a/doc/reference/cogl/html/license.html b/doc/reference/cogl/html/license.html new file mode 100644 index 0000000..d365b88 --- /dev/null +++ b/doc/reference/cogl/html/license.html @@ -0,0 +1,58 @@ + + + + +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 0000000..a31d95d Binary files /dev/null and b/doc/reference/cogl/html/quad-indices-order.png differ 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 0000000..18c42c8 Binary files /dev/null and b/doc/reference/cogl/html/quad-indices-triangles.png differ diff --git a/doc/reference/cogl/html/right.png b/doc/reference/cogl/html/right.png new file mode 100644 index 0000000..92832e3 Binary files /dev/null and b/doc/reference/cogl/html/right.png differ diff --git a/doc/reference/cogl/html/style.css b/doc/reference/cogl/html/style.css new file mode 100644 index 0000000..d6f6c26 --- /dev/null +++ b/doc/reference/cogl/html/style.css @@ -0,0 +1,266 @@ +.synopsis, .classsynopsis +{ + /* tango:aluminium 1/2 */ + background: #eeeeec; + border: solid 1px #d3d7cf; + padding: 0.5em; +} +.programlisting +{ + /* tango:sky blue 0/1 */ + background: #e6f3ff; + border: solid 1px #729fcf; + padding: 0.5em; +} +.variablelist +{ + padding: 4px; + margin-left: 3em; +} +.variablelist td:first-child +{ + vertical-align: top; +} + +@media screen { + sup a.footnote + { + position: relative; + top: 0em ! important; + + } + /* this is needed so that the local anchors are displayed below the naviagtion */ + div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name] + { + display: inline-block; + position: relative; + top:-5em; + } + /* this seems to be a bug in the xsl style sheets when generating indexes */ + div.index div.index + { + top: 0em; + } + /* make space for the fixed navigation bar and add space at the bottom so that + * link targets appear somewhat close to top + */ + body + { + padding-top: 3.2em; + padding-bottom: 20em; + } + /* style and size the navigation bar */ + table.navigation#top + { + position: fixed; + /* tango:scarlet red 0/1 */ + background: #ffe6e6; + border: solid 1px #ef2929; + margin-top: 0; + margin-bottom: 0; + top: 0; + left: 0; + height: 3em; + z-index: 10; + } + .navigation a, .navigation a:visited + { + /* tango:scarlet red 3 */ + color: #a40000; + } + .navigation a:hover + { + /* tango:scarlet red 1 */ + color: #ef2929; + } + td.shortcuts + { + /* tango:scarlet red 1 */ + color: #ef2929; + font-size: 80%; + white-space: nowrap; + } +} +@media print { + table.navigation { + visibility: collapse; + display: none; + } + div.titlepage table.navigation { + visibility: visible; + display: table; + /* tango:scarlet red 0/1 */ + background: #ffe6e6; + border: solid 1px #ef2929; + margin-top: 0; + margin-bottom: 0; + top: 0; + left: 0; + height: 3em; + } +} + +.navigation .title +{ + font-size: 200%; +} + +div.gallery-float +{ + float: left; + padding: 10px; +} +div.gallery-float img +{ + border-style: none; +} +div.gallery-spacer +{ + clear: both; +} + +a, a:visited +{ + text-decoration: none; + /* tango:sky blue 2 */ + color: #3465a4; +} +a:hover +{ + text-decoration: underline; + /* tango:sky blue 1 */ + color: #729fcf; +} + +div.table table +{ + border-collapse: collapse; + border-spacing: 0px; + /* tango:aluminium 3 */ + border: solid 1px #babdb6; +} + +div.table table td, div.table table th +{ + /* tango:aluminium 3 */ + border: solid 1px #babdb6; + padding: 3px; + vertical-align: top; +} + +div.table table th +{ + /* tango:aluminium 2 */ + background-color: #d3d7cf; +} + +hr +{ + /* tango:aluminium 3 */ + color: #babdb6; + background: #babdb6; + border: none 0px; + height: 1px; + clear: both; +} + +.footer +{ + padding-top: 3.5em; + /* tango:aluminium 3 */ + color: #babdb6; + text-align: center; + font-size: 80%; +} + +.warning +{ + /* tango:orange 0/1 */ + background: #ffeed9; + border-color: #ffb04f; +} +.note +{ + /* tango:chameleon 0/0.5 */ + background: #d8ffb2; + border-color: #abf562; +} +.note, .warning +{ + padding: 0.5em; + border-width: 1px; + border-style: solid; +} +.note h3, .warning h3 +{ + margin-top: 0.0em +} +.note p, .warning p +{ + margin-bottom: 0.0em +} + +/* blob links */ +h2 .extralinks, h3 .extralinks +{ + float: right; + /* tango:aluminium 3 */ + color: #babdb6; + font-size: 80%; + font-weight: normal; +} + +.annotation +{ + /* tango:aluminium 5 */ + color: #555753; + font-size: 80%; + font-weight: normal; +} + +/* code listings */ + +.listing_code .programlisting .cbracket { color: #a40000; } /* tango: scarlet red 3 */ +.listing_code .programlisting .comment { color: #a1a39d; } /* tango: aluminium 4 */ +.listing_code .programlisting .function { color: #000000; font-weight: bold; } +.listing_code .programlisting .function a { color: #11326b; font-weight: bold; } /* tango: sky blue 4 */ +.listing_code .programlisting .keyword { color: #4e9a06; } /* tango: chameleon 3 */ +.listing_code .programlisting .linenum { color: #babdb6; } /* tango: aluminium 3 */ +.listing_code .programlisting .normal { color: #000000; } +.listing_code .programlisting .number { color: #75507b; } /* tango: plum 2 */ +.listing_code .programlisting .preproc { color: #204a87; } /* tango: sky blue 3 */ +.listing_code .programlisting .string { color: #c17d11; } /* tango: chocolate 2 */ +.listing_code .programlisting .type { color: #000000; } +.listing_code .programlisting .type a { color: #11326b; } /* tango: sky blue 4 */ +.listing_code .programlisting .symbol { color: #ce5c00; } /* tango: orange 3 */ + +.listing_frame { + /* tango:sky blue 1 */ + border: solid 1px #729fcf; + padding: 0px; +} + +.listing_lines, .listing_code { + margin-top: 0px; + margin-bottom: 0px; + padding: 0.5em; +} +.listing_lines { + /* tango:sky blue 0.5 */ + background: #a6c5e3; + /* tango:aluminium 6 */ + color: #2e3436; +} +.listing_code { + /* tango:sky blue 0 */ + background: #e6f3ff; +} +.listing_code .programlisting { + /* override from previous */ + border: none 0px; + padding: 0px; +} +.listing_lines pre, .listing_code pre { + margin: 0px; +} + diff --git a/doc/reference/cogl/html/up.png b/doc/reference/cogl/html/up.png new file mode 100644 index 0000000..85b3e2a Binary files /dev/null and b/doc/reference/cogl/html/up.png differ diff --git a/doc/reference/cogl/quad-indices-order.png b/doc/reference/cogl/quad-indices-order.png new file mode 100644 index 0000000..a31d95d Binary files /dev/null and b/doc/reference/cogl/quad-indices-order.png differ diff --git a/doc/reference/cogl/quad-indices-triangles.png b/doc/reference/cogl/quad-indices-triangles.png new file mode 100644 index 0000000..18c42c8 Binary files /dev/null and b/doc/reference/cogl/quad-indices-triangles.png differ diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..f96ae65 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,75 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +INCLUDES = \ + -I$(top_srcdir) + +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 + +programs = cogl-hello cogl-info cogl-msaa +examples_datadir = $(pkgdatadir)/examples-data +examples_data_DATA = + +cogl_hello_SOURCES = cogl-hello.c +cogl_hello_LDADD = $(common_ldadd) +cogl_info_SOURCES = cogl-info.c +cogl_info_LDADD = $(common_ldadd) +cogl_msaa_SOURCES = cogl-msaa.c +cogl_msaa_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 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 +programs += cogland +cogland_SOURCES = cogland.c +cogland_LDADD = $(common_ldadd) +endif + +if SUPPORT_SDL +programs += cogl-sdl-hello +cogl_sdl_hello_SOURCES = cogl-sdl-hello.c +cogl_sdl_hello_LDADD = $(common_ldadd) +endif + +if INSTALL_EXAMPLES +bin_PROGRAMS = $(programs) +else +noinst_PROGRAMS = $(programs) +endif + +EXTRA_DIST = \ + crate.jpg \ + 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..f9eb0d1 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,850 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/build/autotools/Makefile.am.silent +@INSTALL_EXAMPLES_TRUE@am__append_1 = -DCOGL_EXAMPLES_DATA=\""$(pkgdatadir)/examples-data/"\" +@INSTALL_EXAMPLES_FALSE@am__append_2 = -DCOGL_EXAMPLES_DATA=\""$(abs_top_srcdir)/examples/"\" +@BUILD_COGL_PANGO_TRUE@am__append_3 = cogl-crate +@BUILD_COGL_PANGO_TRUE@am__append_4 = crate.jpg +@X11_TESTS_TRUE@am__append_5 = cogl-x11-foreign cogl-x11-tfp +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@am__append_6 = cogland +@SUPPORT_SDL_TRUE@am__append_7 = cogl-sdl-hello +@INSTALL_EXAMPLES_TRUE@bin_PROGRAMS = $(am__EXEEXT_5) +@INSTALL_EXAMPLES_FALSE@noinst_PROGRAMS = $(am__EXEEXT_5) +subdir = examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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 = +@BUILD_COGL_PANGO_TRUE@am__EXEEXT_1 = cogl-crate$(EXEEXT) +@X11_TESTS_TRUE@am__EXEEXT_2 = cogl-x11-foreign$(EXEEXT) \ +@X11_TESTS_TRUE@ cogl-x11-tfp$(EXEEXT) +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@am__EXEEXT_3 = cogland$(EXEEXT) +@SUPPORT_SDL_TRUE@am__EXEEXT_4 = cogl-sdl-hello$(EXEEXT) +am__EXEEXT_5 = cogl-hello$(EXEEXT) cogl-info$(EXEEXT) \ + cogl-msaa$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) $(am__EXEEXT_4) +am__installdirs = "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(examples_datadir)" +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am__cogl_crate_SOURCES_DIST = cogl-crate.c +@BUILD_COGL_PANGO_TRUE@am_cogl_crate_OBJECTS = \ +@BUILD_COGL_PANGO_TRUE@ cogl_crate-cogl-crate.$(OBJEXT) +cogl_crate_OBJECTS = $(am_cogl_crate_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ + $(top_builddir)/cogl/libcogl.la +@BUILD_COGL_PANGO_TRUE@cogl_crate_DEPENDENCIES = \ +@BUILD_COGL_PANGO_TRUE@ $(am__DEPENDENCIES_2) \ +@BUILD_COGL_PANGO_TRUE@ $(am__DEPENDENCIES_1) \ +@BUILD_COGL_PANGO_TRUE@ $(top_builddir)/cogl-pango/libcogl-pango.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +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_hello_OBJECTS = cogl-hello.$(OBJEXT) +cogl_hello_OBJECTS = $(am_cogl_hello_OBJECTS) +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_OBJECTS = cogl-msaa.$(OBJEXT) +cogl_msaa_OBJECTS = $(am_cogl_msaa_OBJECTS) +cogl_msaa_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__cogl_sdl_hello_SOURCES_DIST = cogl-sdl-hello.c +@SUPPORT_SDL_TRUE@am_cogl_sdl_hello_OBJECTS = \ +@SUPPORT_SDL_TRUE@ cogl-sdl-hello.$(OBJEXT) +cogl_sdl_hello_OBJECTS = $(am_cogl_sdl_hello_OBJECTS) +@SUPPORT_SDL_TRUE@cogl_sdl_hello_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__cogl_x11_foreign_SOURCES_DIST = cogl-x11-foreign.c +@X11_TESTS_TRUE@am_cogl_x11_foreign_OBJECTS = \ +@X11_TESTS_TRUE@ cogl-x11-foreign.$(OBJEXT) +cogl_x11_foreign_OBJECTS = $(am_cogl_x11_foreign_OBJECTS) +@X11_TESTS_TRUE@cogl_x11_foreign_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__cogl_x11_tfp_SOURCES_DIST = cogl-x11-tfp.c +@X11_TESTS_TRUE@am_cogl_x11_tfp_OBJECTS = cogl-x11-tfp.$(OBJEXT) +cogl_x11_tfp_OBJECTS = $(am_cogl_x11_tfp_OBJECTS) +@X11_TESTS_TRUE@cogl_x11_tfp_DEPENDENCIES = $(am__DEPENDENCIES_2) +am__cogland_SOURCES_DIST = cogland.c +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@am_cogland_OBJECTS = \ +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@ cogland.$(OBJEXT) +cogland_OBJECTS = $(am_cogland_OBJECTS) +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@cogland_DEPENDENCIES = \ +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@ $(am__DEPENDENCIES_2) +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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(cogl_crate_SOURCES) $(cogl_hello_SOURCES) \ + $(cogl_info_SOURCES) $(cogl_msaa_SOURCES) \ + $(cogl_sdl_hello_SOURCES) $(cogl_x11_foreign_SOURCES) \ + $(cogl_x11_tfp_SOURCES) $(cogland_SOURCES) +DIST_SOURCES = $(am__cogl_crate_SOURCES_DIST) $(cogl_hello_SOURCES) \ + $(cogl_info_SOURCES) $(cogl_msaa_SOURCES) \ + $(am__cogl_sdl_hello_SOURCES_DIST) \ + $(am__cogl_x11_foreign_SOURCES_DIST) \ + $(am__cogl_x11_tfp_SOURCES_DIST) $(am__cogland_SOURCES_DIST) +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' +DATA = $(examples_data_DATA) +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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 '$@; +INCLUDES = \ + -I$(top_srcdir) + +AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) \ + -DCOGL_ENABLE_EXPERIMENTAL_2_0_API $(am__append_1) \ + $(am__append_2) +common_ldadd = \ + $(COGL_DEP_LIBS) \ + $(top_builddir)/cogl/libcogl.la + +programs = cogl-hello cogl-info cogl-msaa $(am__append_3) \ + $(am__append_5) $(am__append_6) $(am__append_7) +examples_datadir = $(pkgdatadir)/examples-data +examples_data_DATA = $(am__append_4) +cogl_hello_SOURCES = cogl-hello.c +cogl_hello_LDADD = $(common_ldadd) +cogl_info_SOURCES = cogl-info.c +cogl_info_LDADD = $(common_ldadd) +cogl_msaa_SOURCES = cogl-msaa.c +cogl_msaa_LDADD = $(common_ldadd) +@BUILD_COGL_PANGO_TRUE@cogl_crate_SOURCES = cogl-crate.c +@BUILD_COGL_PANGO_TRUE@cogl_crate_LDADD = $(common_ldadd) $(COGL_PANGO_DEP_LIBS) $(top_builddir)/cogl-pango/libcogl-pango.la +@BUILD_COGL_PANGO_TRUE@cogl_crate_CFLAGS = $(AM_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) +@X11_TESTS_TRUE@cogl_x11_foreign_SOURCES = cogl-x11-foreign.c +@X11_TESTS_TRUE@cogl_x11_foreign_LDADD = $(common_ldadd) +@X11_TESTS_TRUE@cogl_x11_tfp_SOURCES = cogl-x11-tfp.c +@X11_TESTS_TRUE@cogl_x11_tfp_LDADD = $(common_ldadd) +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@cogland_SOURCES = cogland.c +@SUPPORT_WAYLAND_EGL_SERVER_TRUE@cogland_LDADD = $(common_ldadd) +@SUPPORT_SDL_TRUE@cogl_sdl_hello_SOURCES = cogl-sdl-hello.c +@SUPPORT_SDL_TRUE@cogl_sdl_hello_LDADD = $(common_ldadd) +EXTRA_DIST = \ + crate.jpg \ + 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_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) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + 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-crate$(EXEEXT): $(cogl_crate_OBJECTS) $(cogl_crate_DEPENDENCIES) + @rm -f cogl-crate$(EXEEXT) + $(AM_V_CCLD)$(cogl_crate_LINK) $(cogl_crate_OBJECTS) $(cogl_crate_LDADD) $(LIBS) +cogl-hello$(EXEEXT): $(cogl_hello_OBJECTS) $(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) + @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) + @rm -f cogl-msaa$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_msaa_OBJECTS) $(cogl_msaa_LDADD) $(LIBS) +cogl-sdl-hello$(EXEEXT): $(cogl_sdl_hello_OBJECTS) $(cogl_sdl_hello_DEPENDENCIES) + @rm -f cogl-sdl-hello$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cogl_sdl_hello_OBJECTS) $(cogl_sdl_hello_LDADD) $(LIBS) +cogl-x11-foreign$(EXEEXT): $(cogl_x11_foreign_OBJECTS) $(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) + @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) + @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-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-sdl-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_crate-cogl-crate.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(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` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-examples_dataDATA: $(examples_data_DATA) + @$(NORMAL_INSTALL) + test -z "$(examples_datadir)" || $(MKDIR_P) "$(DESTDIR)$(examples_datadir)" + @list='$(examples_data_DATA)'; test -n "$(examples_datadir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(examples_datadir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(examples_datadir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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) $(DATA) +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ + 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 uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-examples_dataDATA + + +# 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..dacbbab --- /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; + GError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0x80}, + {-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-crate.c b/examples/cogl-crate.c new file mode 100644 index 0000000..61b9cae --- /dev/null +++ b/examples/cogl-crate.c @@ -0,0 +1,308 @@ +#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; + + gboolean 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_framebuffer_draw_primitive (fb, data->crate_pipeline, data->prim); + + 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 +swap_notify_cb (CoglFramebuffer *framebuffer, + void *user_data) +{ + Data *data = user_data; + + data->swap_ready = TRUE; +} + +int +main (int argc, char **argv) +{ + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglFramebuffer *fb; + GError *error = NULL; + Data data; + PangoRectangle hello_label_size; + float fovy, aspect, z_near, z_2d, z_far; + CoglDepthState depth_state; + gboolean has_swap_notify; + + 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 = COGL_FRAMEBUFFER (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_push_framebuffer (fb); + cogl_set_viewport (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_perspective (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_set_modelview_matrix (&data.view); + cogl_pop_framebuffer (); + + /* Initialize some convenient constants */ + cogl_matrix_init_identity (&identity); + cogl_color_set_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_new_from_file (COGL_EXAMPLES_DATA "crate.jpg", + COGL_TEXTURE_NO_SLICING, + COGL_PIXEL_FORMAT_ANY, + &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; + + has_swap_notify = + cogl_has_feature (ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT); + + if (has_swap_notify) + cogl_onscreen_add_swap_buffers_callback (COGL_ONSCREEN (fb), + swap_notify_cb, + &data); + + while (1) + { + CoglPollFD *poll_fds; + int n_poll_fds; + gint64 timeout; + + if (data.swap_ready) + { + paint (&data); + cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); + } + + cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout); + + if (!has_swap_notify) + { + /* If the winsys doesn't support swap event notification + then we'll just redraw constantly */ + data.swap_ready = TRUE; + timeout = 0; + } + + g_poll ((GPollFD *) poll_fds, n_poll_fds, + timeout == -1 ? -1 : timeout / 1000); + + cogl_poll_dispatch (ctx, poll_fds, n_poll_fds); + } + + return 0; +} + diff --git a/examples/cogl-hello.c b/examples/cogl-hello.c new file mode 100644 index 0000000..051f141 --- /dev/null +++ b/examples/cogl-hello.c @@ -0,0 +1,81 @@ +#include +#include +#include + +typedef struct _Data +{ + CoglContext *ctx; + CoglFramebuffer *fb; + CoglPrimitive *triangle; + CoglPipeline *pipeline; +} Data; + +static gboolean +paint_cb (void *user_data) +{ + Data *data = user_data; + + cogl_framebuffer_clear4f (data->fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + cogl_framebuffer_draw_primitive (data->fb, data->pipeline, data->triangle); + cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb)); + + /* If the driver can deliver swap complete events then we can remove + * the idle paint callback until we next get a swap complete event + * otherwise we keep the idle paint callback installed and simply + * paint as fast as the driver will allow... */ + if (cogl_has_feature (data->ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT)) + return FALSE; /* remove the callback */ + else + return TRUE; +} + +static void +swap_complete_cb (CoglFramebuffer *framebuffer, void *user_data) +{ + g_idle_add (paint_cb, user_data); +} + +int +main (int argc, char **argv) +{ + Data data; + CoglOnscreen *onscreen; + GError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0x80}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + GSource *cogl_source; + GMainLoop *loop; + + 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 = COGL_FRAMEBUFFER (onscreen); + + 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); + + if (cogl_has_feature (data.ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT)) + cogl_onscreen_add_swap_buffers_callback (COGL_ONSCREEN (data.fb), + swap_complete_cb, &data); + + 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-info.c b/examples/cogl-info.c new file mode 100644 index 0000000..988e991 --- /dev/null +++ b/examples/cogl-info.c @@ -0,0 +1,181 @@ +#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" + } +}; + +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); +} + +int +main (int argc, char **argv) +{ + CoglRenderer *renderer; + CoglDisplay *display; + CoglContext *ctx; + GError *error = NULL; + CoglWinsysID winsys_id; + const char *winsys_name; + + ctx = cogl_context_new (NULL, &error); + 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); + + return 0; +} diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c new file mode 100644 index 0000000..0b1b590 --- /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; + GError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0x80}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + CoglPrimitive *triangle; + CoglHandle tex; + CoglHandle 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 = COGL_FRAMEBUFFER (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); + g_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_new_with_size (320, 480, + COGL_TEXTURE_NO_SLICING, + COGL_PIXEL_FORMAT_ANY); + offscreen = cogl_offscreen_new_to_texture (tex); + offscreen_fb = COGL_FRAMEBUFFER (offscreen); + cogl_framebuffer_set_samples_per_pixel (offscreen_fb, 4); + if (!cogl_framebuffer_allocate (offscreen_fb, &error)) + { + g_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; + gint64 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_framebuffer_draw_primitive (fb, pipeline, triangle); + cogl_framebuffer_pop_matrix (fb); + + cogl_framebuffer_draw_primitive (fb, pipeline, triangle); + 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_get_info (ctx, &poll_fds, &n_poll_fds, &timeout); + g_poll ((GPollFD *) poll_fds, n_poll_fds, 0); + cogl_poll_dispatch (ctx, poll_fds, n_poll_fds); + } + + return 0; +} diff --git a/examples/cogl-sdl-hello.c b/examples/cogl-sdl-hello.c new file mode 100644 index 0000000..8643c38 --- /dev/null +++ b/examples/cogl-sdl-hello.c @@ -0,0 +1,181 @@ +#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; + gboolean quit; +} 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_framebuffer_draw_primitive (fb, data->pipeline, data->triangle); + 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_VIDEOEXPOSE: + redraw (data); + break; + + 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; + + redraw (data); + } + break; + + case SDL_QUIT: + data->quit = TRUE; + break; + } +} + +static Uint32 +timer_handler (Uint32 interval, void *user_data) +{ + static const SDL_UserEvent dummy_event = + { + SDL_USEREVENT + }; + + /* Post an event to wake up from SDL_WaitEvent */ + SDL_PushEvent ((SDL_Event *) &dummy_event); + + return 0; +} + +static gboolean +wait_event_with_timeout (Data *data, SDL_Event *event, gint64 timeout) +{ + if (timeout == -1) + { + if (SDL_WaitEvent (event)) + return TRUE; + else + { + data->quit = TRUE; + return FALSE; + } + } + else if (timeout == 0) + return SDL_PollEvent (event); + else + { + gboolean ret; + /* Add a timer so that we can wake up the event loop */ + SDL_TimerID timer_id = + SDL_AddTimer (timeout / 1000, timer_handler, data); + + if (SDL_WaitEvent (event)) + ret = TRUE; + else + { + data->quit = TRUE; + ret = FALSE; + } + + SDL_RemoveTimer (timer_id); + + return ret; + } +} + +int +main (int argc, char **argv) +{ + CoglRenderer *renderer; + CoglDisplay *display; + CoglContext *ctx; + CoglOnscreen *onscreen; + GError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0x80}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + Data data; + SDL_Event event; + + /* Force the SDL winsys */ + renderer = cogl_renderer_new (); + cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_SDL); + display = cogl_display_new (renderer, NULL); + ctx = cogl_context_new (display, &error); + if (!ctx) + { + fprintf (stderr, "Failed to create context: %s\n", error->message); + return 1; + } + + SDL_InitSubSystem (SDL_INIT_TIMER); + + onscreen = cogl_onscreen_new (ctx, 800, 600); + data.fb = COGL_FRAMEBUFFER (onscreen); + + 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); + while (!data.quit) + { + CoglPollFD *poll_fds; + int n_poll_fds; + gint64 timeout; + + cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout); + + /* It's difficult to wait for file descriptors using the SDL + event mechanism, but it the SDL winsys is documented that it + will never require this so we can assert that there are no + fds */ + g_assert (n_poll_fds == 0); + + if (wait_event_with_timeout (&data, &event, timeout)) + do + handle_event (&data, &event); + while (SDL_PollEvent (&event)); + + cogl_poll_dispatch (ctx, poll_fds, n_poll_fds); + } + + cogl_object_unref (ctx); + cogl_object_unref (display); + cogl_object_unref (renderer); + + return 0; +} diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c new file mode 100644 index 0000000..7329a3f --- /dev/null +++ b/examples/cogl-x11-foreign.c @@ -0,0 +1,183 @@ +#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, + guint32 event_mask, + void *user_data) +{ + Display *xdpy = user_data; + XSetWindowAttributes attrs; + guint32 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; + CoglRenderer *renderer; + CoglSwapChain *chain; + CoglOnscreenTemplate *onscreen_template; + CoglDisplay *display; + CoglContext *ctx; + CoglOnscreen *onscreen; + CoglFramebuffer *fb; + CoglPipeline *pipeline; + GError *error = NULL; + guint32 visual; + XVisualInfo template, *xvisinfo; + int visinfos_count; + XSetWindowAttributes xattr; + unsigned long mask; + Window xwin; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0x80}, + {-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 = COGL_FRAMEBUFFER (onscreen); + + 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; + gint64 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); + } + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + cogl_framebuffer_draw_primitive (fb, pipeline, triangle); + cogl_onscreen_swap_buffers (onscreen); + + cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout); + g_poll ((GPollFD *) poll_fds, n_poll_fds, 0); + cogl_poll_dispatch (ctx, poll_fds, n_poll_fds); + } + + return 0; +} diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c new file mode 100644 index 0000000..eb1b237 --- /dev/null +++ b/examples/cogl-x11-tfp.c @@ -0,0 +1,230 @@ +#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, + guint32 event_mask, + void *user_data) +{ + Display *xdpy = user_data; + XSetWindowAttributes attrs; + guint32 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; + GError *error = NULL; + guint32 visual; + XVisualInfo template, *xvisinfo; + int visinfos_count; + XSetWindowAttributes xattr; + unsigned long mask; + Window xwin; + 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); + 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); + + 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); + + 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 = COGL_FRAMEBUFFER (onscreen); + cogl_push_framebuffer (fb); + + for (;;) + { + unsigned long pixel; + + 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; + } + 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); + cogl_set_source_texture (COGL_TEXTURE (tfp)); + cogl_rectangle (-0.8, 0.8, 0.8, -0.8); + cogl_onscreen_swap_buffers (onscreen); + } + + return 0; +} diff --git a/examples/cogland.c b/examples/cogland.c new file mode 100644 index 0000000..6b79160 --- /dev/null +++ b/examples/cogland.c @@ -0,0 +1,770 @@ +#include +#include +#include +#include +#include +#include + +#include + +typedef struct _CoglandCompositor CoglandCompositor; + +typedef struct +{ + struct wl_buffer *wayland_buffer; + CoglTexture2D *texture; + GList *surfaces_attached_to; +} CoglandBuffer; + +typedef struct +{ + CoglandCompositor *compositor; + + struct wl_surface wayland_surface; + int x; + int y; + CoglandBuffer *buffer; + + gboolean has_shell_surface; +} CoglandSurface; + +typedef struct +{ + CoglandSurface *surface; + struct wl_resource resource; + struct wl_listener surface_destroy_listener; +} CoglandShellSurface; + +typedef struct +{ + guint32 flags; + int width; + int height; + int refresh; +} CoglandMode; + +typedef struct +{ + struct wl_object wayland_output; + + gint32 x; + gint32 y; + gint32 width_mm; + gint32 height_mm; + + CoglOnscreen *onscreen; + + GList *modes; + +} CoglandOutput; + +typedef struct +{ + GSource source; + GPollFD pfd; + struct wl_event_loop *loop; +} WaylandEventSource; + +struct _CoglandCompositor +{ + struct wl_display *wayland_display; + struct wl_shm *wayland_shm; + struct wl_event_loop *wayland_loop; + + CoglDisplay *cogl_display; + CoglContext *cogl_context; + + int virtual_width; + int virtual_height; + GList *outputs; + + GQueue frame_callbacks; + + CoglPrimitive *triangle; + CoglPipeline *triangle_pipeline; + + GSource *wayland_event_source; + + GList *surfaces; +}; + +static guint32 +get_time (void) +{ + struct timeval tv; + gettimeofday (&tv, NULL); + return tv.tv_sec * 1000 + tv.tv_usec / 1000; +} + +static gboolean +wayland_event_source_prepare (GSource *base, int *timeout) +{ + *timeout = -1; + + return FALSE; +} + +static gboolean +wayland_event_source_check (GSource *base) +{ + WaylandEventSource *source = (WaylandEventSource *)base; + return source->pfd.revents; +} + +static gboolean +wayland_event_source_dispatch (GSource *base, + GSourceFunc callback, + void *data) +{ + WaylandEventSource *source = (WaylandEventSource *)base; + wl_event_loop_dispatch (source->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_event_loop *loop) +{ + WaylandEventSource *source; + + source = (WaylandEventSource *) g_source_new (&wayland_event_source_funcs, + sizeof (WaylandEventSource)); + source->loop = loop; + 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 CoglandBuffer * +cogland_buffer_new (struct wl_buffer *wayland_buffer) +{ + CoglandBuffer *buffer = g_slice_new (CoglandBuffer); + + buffer->wayland_buffer = wayland_buffer; + buffer->texture = NULL; + buffer->surfaces_attached_to = NULL; + + return buffer; +} + +static void +cogland_buffer_free (CoglandBuffer *buffer) +{ + GList *l; + + buffer->wayland_buffer->user_data = NULL; + + for (l = buffer->surfaces_attached_to; l; l = l->next) + { + CoglandSurface *surface = l->data; + surface->buffer = NULL; + } + + if (buffer->texture) + cogl_object_unref (buffer->texture); + + g_list_free (buffer->surfaces_attached_to); + g_slice_free (CoglandBuffer, buffer); +} + +static void +shm_buffer_created (struct wl_buffer *wayland_buffer) +{ + wayland_buffer->user_data = cogland_buffer_new (wayland_buffer); +} + +static void +shm_buffer_damaged (struct wl_buffer *wayland_buffer, + gint32 x, + gint32 y, + gint32 width, + gint32 height) +{ + CoglandBuffer *buffer = wayland_buffer->user_data; + + if (buffer->texture) + { + CoglPixelFormat format; + + switch (wl_shm_buffer_get_format (wayland_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; + 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; + break; +#endif + default: + g_warn_if_reached (); + format = COGL_PIXEL_FORMAT_ARGB_8888; + } + + cogl_texture_set_region (COGL_TEXTURE (buffer->texture), + x, y, + x, y, + width, height, + width, height, + format, + wl_shm_buffer_get_stride (wayland_buffer), + wl_shm_buffer_get_data (wayland_buffer)); + } +} + +static void +shm_buffer_destroyed (struct wl_buffer *wayland_buffer) +{ + if (wayland_buffer->user_data) + cogland_buffer_free ((CoglandBuffer *)wayland_buffer->user_data); +} + +const static struct wl_shm_callbacks shm_callbacks = { + shm_buffer_created, + shm_buffer_damaged, + shm_buffer_destroyed +}; + +static void +cogland_surface_destroy (struct wl_client *wayland_client, + struct wl_resource *wayland_resource) +{ + wl_resource_destroy (wayland_resource, get_time ()); +} + +static void +cogland_surface_detach_buffer (CoglandSurface *surface) +{ + CoglandBuffer *buffer = surface->buffer; + + if (buffer) + { + buffer->surfaces_attached_to = + g_list_remove (buffer->surfaces_attached_to, surface); + if (buffer->surfaces_attached_to == NULL) + cogland_buffer_free (buffer); + surface->buffer = NULL; + } +} + +static void +cogland_surface_attach_buffer (struct wl_client *wayland_client, + struct wl_resource *wayland_surface_resource, + struct wl_resource *wayland_buffer_resource, + gint32 dx, gint32 dy) +{ + struct wl_buffer *wayland_buffer = wayland_buffer_resource->data; + CoglandBuffer *buffer = wayland_buffer->user_data; + CoglandSurface *surface = wayland_surface_resource->data; + CoglandCompositor *compositor = surface->compositor; + + /* XXX: in the case where we are reattaching the same buffer we can + * simply bail out. Note this is important because if we don't bail + * out then the _detach_buffer will actually end up destroying the + * buffer we're trying to attach. */ + if (buffer && surface->buffer == buffer) + return; + + cogland_surface_detach_buffer (surface); + + /* XXX: it seems like for shm buffers we will have been notified of + * the buffer already via the callbacks, but for drm buffers I guess + * this will be the first we know of them? */ + if (!buffer) + { + buffer = cogland_buffer_new (wayland_buffer); + wayland_buffer->user_data = buffer; + } + + g_return_if_fail (g_list_find (buffer->surfaces_attached_to, surface) == NULL); + + buffer->surfaces_attached_to = g_list_prepend (buffer->surfaces_attached_to, + surface); + + if (!buffer->texture) + { + GError *error = NULL; + + buffer->texture = + cogl_wayland_texture_2d_new_from_buffer (compositor->cogl_context, + wayland_buffer, + &error); + if (!buffer->texture) + g_error ("Failed to create texture_2d from wayland buffer: %s", + error->message); + } + + surface->buffer = buffer; +} + +static void +cogland_surface_damage (struct wl_client *client, + struct wl_resource *resource, + gint32 x, + gint32 y, + gint32 width, + gint32 height) +{ +} + +typedef struct _CoglandFrameCallback +{ + /* GList node used as an embedded list */ + GList node; + + /* Pointer back to the compositor */ + CoglandCompositor *compositor; + + struct wl_resource resource; +} CoglandFrameCallback; + +static void +destroy_frame_callback (struct wl_resource *callback_resource) +{ + CoglandFrameCallback *callback = callback_resource->data; + + g_queue_unlink (&callback->compositor->frame_callbacks, + &callback->node); + g_slice_free (CoglandFrameCallback, callback); +} + +static void +cogland_surface_frame (struct wl_client *client, + struct wl_resource *surface_resource, + guint32 callback_id) +{ + CoglandFrameCallback *callback; + CoglandSurface *surface = surface_resource->data; + + callback = g_slice_new0 (CoglandFrameCallback); + callback->compositor = surface->compositor; + callback->node.data = callback; + callback->resource.object.interface = &wl_callback_interface; + callback->resource.object.id = callback_id; + callback->resource.destroy = destroy_frame_callback; + callback->resource.data = callback; + + wl_client_add_resource (client, &callback->resource); + + g_queue_push_tail_link (&surface->compositor->frame_callbacks, + &callback->node); +} + +const struct wl_surface_interface cogland_surface_interface = { + cogland_surface_destroy, + cogland_surface_attach_buffer, + cogland_surface_damage, + cogland_surface_frame +}; + +static void +cogland_surface_free (CoglandSurface *surface) +{ + CoglandCompositor *compositor = surface->compositor; + compositor->surfaces = g_list_remove (compositor->surfaces, surface); + cogland_surface_detach_buffer (surface); + g_slice_free (CoglandSurface, surface); +} +static void +cogland_surface_resource_destroy_cb (struct wl_resource *resource) +{ + CoglandSurface *surface = resource->data; + cogland_surface_free (surface); +} + +static void +cogland_compositor_create_surface (struct wl_client *wayland_client, + struct wl_resource *wayland_compositor_resource, + guint32 id) +{ + CoglandCompositor *compositor = wayland_compositor_resource->data; + CoglandSurface *surface = g_slice_new0 (CoglandSurface); + + surface->compositor = compositor; + + surface->wayland_surface.resource.destroy = + cogland_surface_resource_destroy_cb; + surface->wayland_surface.resource.object.id = id; + surface->wayland_surface.resource.object.interface = &wl_surface_interface; + surface->wayland_surface.resource.object.implementation = + (void (**)(void)) &cogland_surface_interface; + surface->wayland_surface.resource.data = surface; + + wl_client_add_resource (wayland_client, &surface->wayland_surface.resource); + + compositor->surfaces = g_list_prepend (compositor->surfaces, + surface); +} + +static void +bind_output (struct wl_client *client, + void *data, + guint32 version, + guint32 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 +cogland_compositor_create_output (CoglandCompositor *compositor, + int x, + int y, + int width_mm, + int height_mm) +{ + CoglandOutput *output = g_slice_new0 (CoglandOutput); + CoglFramebuffer *fb; + GError *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 = COGL_FRAMEBUFFER (output->onscreen); + if (!cogl_framebuffer_allocate (fb, &error)) + g_error ("Failed to allocate framebuffer: %s\n", error->message); + + cogl_onscreen_show (output->onscreen); +#if 0 + cogl_framebuffer_set_viewport (fb, x, y, width, height); +#else + cogl_push_framebuffer (fb); + cogl_set_viewport (-x, -y, + compositor->virtual_width, + compositor->virtual_height); + cogl_pop_framebuffer (); +#endif + + 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); +} + +static gboolean +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 = COGL_FRAMEBUFFER (output->onscreen); + GList *l2; + + cogl_push_framebuffer (fb); + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_framebuffer_draw_primitive (fb, compositor->triangle_pipeline, + compositor->triangle); + + for (l2 = compositor->surfaces; l2; l2 = l2->next) + { + CoglandSurface *surface = l2->data; + + if (surface->buffer) + { + CoglTexture2D *texture = surface->buffer->texture; + cogl_set_source_texture (COGL_TEXTURE (texture)); + cogl_rectangle (-1, 1, 1, -1); + } + } + cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); + + cogl_pop_framebuffer (); + } + + while (!g_queue_is_empty (&compositor->frame_callbacks)) + { + CoglandFrameCallback *callback = + g_queue_peek_head (&compositor->frame_callbacks); + + wl_resource_post_event (&callback->resource, + WL_CALLBACK_DONE, get_time ()); + wl_resource_destroy (&callback->resource, 0); + } + + return TRUE; +} + +const static struct wl_compositor_interface cogland_compositor_interface = +{ + cogland_compositor_create_surface, +}; + +static void +compositor_bind (struct wl_client *client, + void *data, + guint32 version, + guint32 id) +{ + CoglandCompositor *compositor = data; + + wl_client_add_object (client, &wl_compositor_interface, + &cogland_compositor_interface, id, compositor); +} + +static void +shell_surface_move (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *input_device, + uint32_t time) +{ +} + +static void +shell_surface_resize (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *input_device, + uint32_t time, + 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) +{ +} + +static const struct wl_shell_surface_interface cogl_shell_surface_interface = +{ + shell_surface_move, + shell_surface_resize, + shell_surface_set_toplevel, + shell_surface_set_transient, + shell_surface_set_fullscreen +}; + +static void +shell_handle_surface_destroy (struct wl_listener *listener, + struct wl_resource *resource, + uint32_t time) +{ + CoglandShellSurface *shell_surface = container_of (listener, + CoglandShellSurface, + surface_destroy_listener); + + shell_surface->surface->has_shell_surface = FALSE; + shell_surface->surface = NULL; + wl_resource_destroy (&shell_surface->resource, time); +} + +static void +destroy_shell_surface (struct wl_resource *resource) +{ + CoglandShellSurface *shell_surface = resource->data; + + /* 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 +get_shell_surface (struct wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct wl_resource *surface_resource) +{ + CoglandSurface *surface = surface_resource->data; + CoglandShellSurface *shell_surface = g_new0 (CoglandShellSurface, 1); + + 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->resource.destroy = destroy_shell_surface; + shell_surface->resource.object.id = id; + shell_surface->resource.object.interface = &wl_shell_surface_interface; + shell_surface->resource.object.implementation = + (void (**) (void)) &cogl_shell_surface_interface; + shell_surface->resource.data = shell_surface; + + shell_surface->surface = surface; + shell_surface->surface_destroy_listener.func = shell_handle_surface_destroy; + wl_list_insert (surface->wayland_surface.resource.destroy_listener_list.prev, + &shell_surface->surface_destroy_listener.link); + + surface->has_shell_surface = TRUE; + + wl_client_add_resource (client, &shell_surface->resource); +} + +static const struct wl_shell_interface cogland_shell_interface = +{ + get_shell_surface +}; + +static void +bind_shell (struct wl_client *client, + void *data, + guint32 version, + guint32 id) +{ + wl_client_add_object (client, &wl_shell_interface, + &cogland_shell_interface, id, data); +} + +int +main (int argc, char **argv) +{ + CoglandCompositor compositor; + GMainLoop *loop; + GError *error = NULL; + CoglVertexP2C4 triangle_vertices[] = { + {0, 0.7, 0xff, 0x00, 0x00, 0x80}, + {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff}, + {0.7, -0.7, 0x00, 0x00, 0xff, 0xff} + }; + GSource *cogl_source; + + memset (&compositor, 0, sizeof (compositor)); + + compositor.wayland_display = wl_display_create (); + if (compositor.wayland_display == NULL) + g_error ("failed to create wayland display"); + + g_queue_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"); + + compositor.wayland_shm = wl_shm_init (compositor.wayland_display, + &shm_callbacks); + if (!compositor.wayland_shm) + g_error ("Failed to allocate setup wayland shm callbacks"); + + 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_loop); + g_source_attach (compositor.wayland_event_source, NULL); + + compositor.cogl_display = cogl_display_new (NULL, NULL); + cogl_wayland_display_set_compositor_display (compositor.cogl_display, + compositor.wayland_display); + + compositor.cogl_context = cogl_context_new (compositor.cogl_display, &error); + if (!compositor.cogl_context) + g_error ("Failed to create a Cogl context: %s\n", error->message); + + compositor.virtual_width = 640; + compositor.virtual_height = 480; + + /* Emulate compositing with multiple monitors... */ + cogland_compositor_create_output (&compositor, 0, 0, 320, 240); + cogland_compositor_create_output (&compositor, 320, 0, 320, 240); + cogland_compositor_create_output (&compositor, 0, 240, 320, 240); + cogland_compositor_create_output (&compositor, 320, 240, 320, 240); + + 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); + + g_timeout_add (16, paint_cb, &compositor); + + 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 0000000..2807459 Binary files /dev/null and b/examples/crate.jpg differ diff --git a/gtk-doc.make b/gtk-doc.make new file mode 100644 index 0000000..9841de4 --- /dev/null +++ b/gtk-doc.make @@ -0,0 +1,256 @@ +# -*- mode: makefile -*- + +#################################### +# Everything below here is generic # +#################################### + +if GTK_DOC_USE_LIBTOOL +GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +GTKDOC_RUN = $(LIBTOOL) --mode=execute +else +GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +GTKDOC_RUN = +endif + +# 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. +# +GPATH = $(srcdir) + +TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) + +SETUP_FILES = \ + $(content_files) \ + $(DOC_MAIN_SGML_FILE) \ + $(DOC_MODULE)-sections.txt \ + $(DOC_MODULE)-overrides.txt + +EXTRA_DIST = \ + $(HTML_IMAGES) \ + $(SETUP_FILES) + +DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \ + html-build.stamp pdf-build.stamp \ + sgml.stamp html.stamp pdf.stamp + +SCANOBJ_FILES = \ + $(DOC_MODULE).args \ + $(DOC_MODULE).hierarchy \ + $(DOC_MODULE).interfaces \ + $(DOC_MODULE).prerequisites \ + $(DOC_MODULE).signals + +REPORT_FILES = \ + $(DOC_MODULE)-undocumented.txt \ + $(DOC_MODULE)-undeclared.txt \ + $(DOC_MODULE)-unused.txt + +CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) + +if ENABLE_GTK_DOC +if GTK_DOC_BUILD_HTML +HTML_BUILD_STAMP=html-build.stamp +else +HTML_BUILD_STAMP= +endif +if GTK_DOC_BUILD_PDF +PDF_BUILD_STAMP=pdf-build.stamp +else +PDF_BUILD_STAMP= +endif + +all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) +else +all-local: +endif + +docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) + +$(REPORT_FILES): sgml-build.stamp + +#### setup #### + +setup-build.stamp: + -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + echo ' DOC Preparing build'; \ + files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ + if test "x$$files" != "x" ; then \ + for file in $$files ; do \ + test -f $(abs_srcdir)/$$file && \ + cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ + done; \ + fi; \ + fi + @touch setup-build.stamp + + +#### scan #### + +scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) + @echo ' DOC Scanning header files' + @_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ + _source_dir="$${_source_dir} --source-dir=$$i" ; \ + done ; \ + gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) + @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ + echo " DOC Introspecting gobjects"; \ + 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 + @touch scan-build.stamp + +$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp + @true + +#### xml #### + +sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) + @echo ' DOC Building 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) + @touch sgml-build.stamp + +sgml.stamp: sgml-build.stamp + @true + +#### html #### + +html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) + @echo ' DOC Building 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; + @echo ' DOC Fixing cross-references' + @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + @touch html-build.stamp + +#### pdf #### + +pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) + @echo ' DOC Building 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) + @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: clean + @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: +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/packaging/cogl-1.10.2.sha256sum b/packaging/cogl-1.10.2.sha256sum new file mode 100644 index 0000000..472fb15 --- /dev/null +++ b/packaging/cogl-1.10.2.sha256sum @@ -0,0 +1,2 @@ +ce4705693e98c064d5493913b2ffe23a49a9c83b644b2277d882b960369bc545 cogl-1.10.2.tar.bz2 +4aab7f8154906b477f7ae2f7c8fd4b2fea7e8e79cd65496b36e49cc4c5493ce8 cogl-1.10.2.tar.xz diff --git a/packaging/cogl.changes b/packaging/cogl.changes new file mode 100644 index 0000000..164928f --- /dev/null +++ b/packaging/cogl.changes @@ -0,0 +1,3 @@ +* Sat May 19 00:07:57 UTC 2012 - tu.c.truong@intel.com +- Initial commit to Gerrit + diff --git a/packaging/cogl.spec b/packaging/cogl.spec new file mode 100644 index 0000000..e158d95 --- /dev/null +++ b/packaging/cogl.spec @@ -0,0 +1,101 @@ +Name: cogl +Summary: Open Source 3D graphics library for creating rich graphical applications +Version: 1.10.2 +Release: 1 +Group: System/Libraries +License: LGPLv2+ +URL: http://www.clutter-project.org/ +Source0: http://source.clutter-project.org/sources/cogl/1.10/cogl-%{version}.tar.xz +Source1: http://source.clutter-project.org/sources/cogl/1.10/cogl-%{version}.sha256sum +Patch0: gl-header-include-fix.patch +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(pango) +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xcomposite) +BuildRequires: pkgconfig(xdamage) +BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xfixes) +BuildRequires: pkgconfig(glesv2) +BuildRequires: pkgconfig(glesv1_cm) +BuildRequires: pkgconfig(gl) +BuildRequires: pkgconfig(egl) +BuildRequires: pkgconfig(gdk-pixbuf-2.0) +BuildRequires: pkgconfig(libdrm) +BuildRequires: pkgconfig(dri2proto) +BuildRequires: pkgconfig(glproto) +BuildRequires: pkgconfig(xxf86vm) +BuildRequires: pkgconfig(wayland-client) +BuildRequires: pkgconfig(wayland-egl) +BuildRequires: intltool + + +%description +Cogl is a modern 3D graphics library that avoids the flat state-machine API style of OpenGL making it easier to write orthogonal rendering code. Cogl supports using OpenGL and OpenGLES 1.1/2.0 as backends so a wide range of devices can be targetted. Also because Cogl can integrate the huge number of vendor specific OpenGL extensions behind a consistent interface it helps you get the very best out of your specific device for less effort than using OpenGL. + + + +%package devel +Summary: Cogl header files and development libraries +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Development environment for Cogl + +%package examples +Summary: Cogl examples +Group: Amusements/Graphics +Requires: %{name} = %{version}-%{release} + +%description examples +Example Cogl apps + + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 + +%build + +%configure --disable-static \ + --enable-gl \ + --enable-gles1 \ + --enable-gles2 \ + --enable-wayland-egl-platform=yes \ + --enable-xlib-egl-platform=yes \ + --enable-examples-install + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%find_lang cogl + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + + + +%files -f cogl.lang +%defattr(-,root,root,-) +%doc COPYING README +%{_libdir}/*.so.* + +%files devel +%defattr(-,root,root,-) +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/* + +%files examples +%defattr(-,root,root,-) +%{_datadir}/cogl/* +%{_bindir}/* + diff --git a/packaging/gl-header-include-fix.patch b/packaging/gl-header-include-fix.patch new file mode 100644 index 0000000..c116393 --- /dev/null +++ b/packaging/gl-header-include-fix.patch @@ -0,0 +1,273 @@ +From e99770dcc31f0382cb699bbfbb8a30b21bcdb9a8 Mon Sep 17 00:00:00 2001 +From: Neil Roberts +Date: Wed, 2 May 2012 13:08:01 +0100 +Subject: [PATCH] Don't include any GL header from the public GL headers + +This splits the GL header inclusion from cogl-defines.h into a +separate headear called cogl-gl-header.h which we will only include +internally. That way we don't leak GL declarations out of our public +headers. The texture functions that were using GLenum and GLuint in +the public header have now changed to just use unsigned int. Note +however that if an EGL winsys is enabled then it will still publicly +include an EGL header. This is a bit more awkward to fix because we +have public API which returns an EGLDisplay and we can't determine +what type that is. + +There is also a conformance test which just verifies that no GL header +has been included while compiling. The test isn't added to +test-conform-main because it doesn't actually test anything at +runtime. + +Reviewed-by: Robert Bragg + +(cherry picked from commit ef5680d3fda5df929dbd0b420c8f598ded58dfee) + +Conflicts: + + cogl/cogl-context-private.h + cogl/cogl-sampler-cache-private.h +--- + cogl/Makefile.am | 6 ++-- + cogl/cogl-buffer-private.h | 1 + + cogl/cogl-context-private.h | 1 + + cogl/cogl-defines.h.in | 4 --- + cogl/cogl-gl-header.h.in | 39 +++++++++++++++++++++++++++++++++++++ + cogl/cogl-internal.h | 1 + + cogl/cogl-shader-private.h | 1 + + cogl/cogl-texture.h | 16 +++++++------- + cogl/tesselator/tesselator.h | 1 + + configure.ac | 1 + + tests/conform/Makefile.am | 1 + + tests/conform/test-no-gl-header.c | 17 ++++++++++++++++ + 12 files changed, 74 insertions(+), 15 deletions(-) + create mode 100644 cogl/cogl-gl-header.h.in + create mode 100644 tests/conform/test-no-gl-header.c + +diff --git a/cogl/Makefile.am b/cogl/Makefile.am +index f6dbb0d..236963e 100644 +--- a/cogl/Makefile.am ++++ b/cogl/Makefile.am +@@ -34,9 +34,9 @@ AM_CPPFLAGS = \ + + AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) + +-BUILT_SOURCES += cogl-defines.h +-DISTCLEANFILES += cogl-defines.h +-EXTRA_DIST += cogl-defines.h.in ++BUILT_SOURCES += cogl-defines.h cogl-gl-header.h ++DISTCLEANFILES += cogl-defines.h cogl-gl-header.h ++EXTRA_DIST += cogl-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 +diff --git a/cogl/cogl-buffer-private.h b/cogl/cogl-buffer-private.h +index 62bcf45..0457af0 100644 +--- a/cogl/cogl-buffer-private.h ++++ b/cogl/cogl-buffer-private.h +@@ -33,6 +33,7 @@ + #include "cogl-object-private.h" + #include "cogl-buffer.h" + #include "cogl-context.h" ++#include "cogl-gl-header.h" + + G_BEGIN_DECLS + +diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h +index 6d92faf..f8c691e 100644 +--- a/cogl/cogl-context-private.h ++++ b/cogl/cogl-context-private.h +@@ -46,6 +46,7 @@ + #include "cogl-texture-2d.h" + #include "cogl-texture-3d.h" + #include "cogl-texture-rectangle.h" ++#include "cogl-gl-header.h" + + typedef struct + { +diff --git a/cogl/cogl-defines.h.in b/cogl/cogl-defines.h.in +index 3d4b17d..ccdca06 100644 +--- a/cogl/cogl-defines.h.in ++++ b/cogl/cogl-defines.h.in +@@ -29,7 +29,6 @@ + #define __COGL_DEFINES_H__ + + #include +-@COGL_GL_HEADER_INCLUDES@ + + G_BEGIN_DECLS + +@@ -41,9 +40,6 @@ G_BEGIN_DECLS + #define NativeWindowType EGLNativeWindowType + #endif + +-#ifndef GL_OES_EGL_image +-#define GLeglImageOES void * +-#endif + G_END_DECLS + + #endif +diff --git a/cogl/cogl-gl-header.h.in b/cogl/cogl-gl-header.h.in +new file mode 100644 +index 0000000..30bc837 +--- /dev/null ++++ b/cogl/cogl-gl-header.h.in +@@ -0,0 +1,39 @@ ++/* ++ * Cogl ++ * ++ * An object oriented GL/GLES Abstraction/Utility Layer ++ * ++ * Copyright (C) 2012 Intel Corporation. ++ * ++ * 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, see . ++ * ++ * ++ */ ++ ++#if !defined(CLUTTER_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-internal.h b/cogl/cogl-internal.h +index 9019859..e40b721 100644 +--- a/cogl/cogl-internal.h ++++ b/cogl/cogl-internal.h +@@ -25,6 +25,7 @@ + #define __COGL_INTERNAL_H + + #include "cogl-bitmask.h" ++#include "cogl-gl-header.h" + + #ifdef COGL_HAS_XLIB_SUPPORT + #include +diff --git a/cogl/cogl-shader-private.h b/cogl/cogl-shader-private.h +index 6c05b3f..06575e6 100644 +--- a/cogl/cogl-shader-private.h ++++ b/cogl/cogl-shader-private.h +@@ -26,6 +26,7 @@ + + #include "cogl-handle.h" + #include "cogl-shader.h" ++#include "cogl-gl-header.h" + + typedef struct _CoglShader CoglShader; + +diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h +index 4eeffb5..c73ea8a 100644 +--- a/cogl/cogl-texture.h ++++ b/cogl/cogl-texture.h +@@ -207,12 +207,12 @@ cogl_texture_new_from_data (unsigned int width, + * Since: 0.8 + */ + CoglTexture * +-cogl_texture_new_from_foreign (GLuint gl_handle, +- GLenum gl_target, +- GLuint width, +- GLuint height, +- GLuint x_pot_waste, +- GLuint y_pot_waste, ++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); + + /** +@@ -353,8 +353,8 @@ cogl_texture_is_sliced (CoglTexture *texture); + */ + gboolean + cogl_texture_get_gl_texture (CoglTexture *texture, +- GLuint *out_gl_handle, +- GLenum *out_gl_target); ++ unsigned int *out_gl_handle, ++ unsigned int *out_gl_target); + + /** + * cogl_texture_get_data: +diff --git a/cogl/tesselator/tesselator.h b/cogl/tesselator/tesselator.h +index 69a6ece..5b651be 100644 +--- a/cogl/tesselator/tesselator.h ++++ b/cogl/tesselator/tesselator.h +@@ -35,6 +35,7 @@ + /* 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; + +diff --git a/configure.ac b/configure.ac +index ecf3d49..99fbf1a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1120,6 +1120,7 @@ cogl/Makefile + cogl/cogl-1.0.pc + cogl/cogl-2.0-experimental.pc + cogl/cogl-defines.h ++cogl/cogl-gl-header.h + cogl/cogl.rc + cogl-pango/Makefile + cogl-pango/cogl-pango-1.0.pc +diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am +index e6ffc7b..5a82b46 100644 +--- a/tests/conform/Makefile.am ++++ b/tests/conform/Makefile.am +@@ -52,6 +52,7 @@ test_sources = \ + test-write-texture-formats.c \ + test-point-size.c \ + test-point-sprite.c \ ++ test-no-gl-header.c \ + $(NULL) + + test_conformance_SOURCES = $(common_sources) $(test_sources) +diff --git a/tests/conform/test-no-gl-header.c b/tests/conform/test-no-gl-header.c +new file mode 100644 +index 0000000..49dae6c +--- /dev/null ++++ b/tests/conform/test-no-gl-header.c +@@ -0,0 +1,17 @@ ++#include ++ ++#include "test-utils.h" ++ ++/* 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) ++{ ++ if (cogl_test_verbose ()) ++ g_print ("OK\n"); ++} ++ +-- +1.7.3.16.g9464b + 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 0000000..c7e5b37 Binary files /dev/null and b/po/an.gmo differ diff --git a/po/an.po b/po/an.po new file mode 100644 index 0000000..e57e1e7 --- /dev/null +++ b/po/an.po @@ -0,0 +1,337 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-24 11:25+0200\n" +"Last-Translator: FULL NAME \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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Opcions de depuracion de Colg que activar" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Opcions de depuracion de Colg que desactivar" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opcions de Colg" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Amostrar as opcions de Colg" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/ar.gmo b/po/ar.gmo new file mode 100644 index 0000000..b2390bd Binary files /dev/null and b/po/ar.gmo differ diff --git a/po/ar.po b/po/ar.po new file mode 100644 index 0000000..2caed39 --- /dev/null +++ b/po/ar.po @@ -0,0 +1,339 @@ +# Arabic translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Abdalrahim G. Fakhouri , 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "شارات تنقيح جتك+ التي ستُضبط" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "شارات تنقيح جتك+ التي ستُصفّر" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "خيارات Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "أظهر خيارات Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/as.gmo b/po/as.gmo new file mode 100644 index 0000000..91ebd49 Binary files /dev/null and b/po/as.gmo differ diff --git a/po/as.po b/po/as.po new file mode 100644 index 0000000..f20f888 --- /dev/null +++ b/po/as.po @@ -0,0 +1,343 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-06 21:03+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:173 +msgid "Supported debug values:" +msgstr "সমৰ্থিত ডিবাগ মানসমূহ:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "বিশেষ ডিবাগ মানসমূহ:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "সকলো অ-ব্যৱহাৰী ডিভাগ বিকল্পসমূহ সামৰ্থবান কৰে" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "সংহতি কৰিবলে Cogl ডিবাগিং ফ্লেগসমূহ" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "অসংহতি কৰিবলে Cogl ডিবাগিং ফ্লেগসমূহ" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl বিকল্পসমূহ" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl বিকল্পসমূহ দেখুৱাওক" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl অনুকৰণ" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject প্ৰসংগসমূহ" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects ৰ বাবে ref গণনা বিষয়সমূহ ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "গাঁথনি স্লাইচিং অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "বাং স্লাইচৰ সৃষ্টি ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "ভূচিত্ৰাৱলীৰ গাঁথনি অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "গাঁথনি ভূচিত্ৰাৱলী ব্যৱস্থাপনা ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "মিশ্ৰণ স্ট্ৰিংসমূহ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString বিশ্লেষণ ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "আলোচনী অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "আলোচনীৰ সকলো জ্যামিতি দৰ্শন কৰক" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "চাম অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "আলোচনীত কিধৰণে জ্যামিতি চাম কৰা হৈছে দেখুৱাওক" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "আধাৰসমূহ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "সকলো আধাৰ পৰিৱৰ্তন অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "বিভিন্ন অঙ্কণ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "কিছুমান বিভিন্ন অঙ্কণ কাৰ্যসমূহ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Pango ৰেণ্ডাৰাৰ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl Pango ৰেণ্ডাৰাৰ অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap বেকএণ্ড অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl গাঁথনি pixmap বেকএণ্ড অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "কল্পনা কৰক" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "সাৰাংশ আয়তসমূহ" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "সকলো আয়তীয় জ্যামিতিৰ বাবে তাঁৰ সাৰাংশসমূহ যোগ কৰক" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "তাঁৰফ্ৰেইমসমূহ দেখুৱাওক" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "সকলো জ্যামিতিৰ বাবে তাঁৰ সাৰাংশসমূহ যোগ কৰক" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "মূল কাৰণ" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "আলোচনী চাম অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl আলোচনীত জ্যামিতিৰ চাম অসামৰ্থবান কৰক।" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "GL শীৰ্ষবিন্দু বাফাৰসমূহ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL শীৰ্ষবিন্দু বাফাৰ অবজেক্টসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "GL পিক্সেল বাফাৰসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL পিক্সেল বাফাৰসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "চফ্টৱেৰ ৰেক্ট পৰিৱৰ্তন অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "আয়তীয় জ্যামিতি পৰিৱৰ্তন কৰিবলে GPU ব্যৱহাৰ কৰক" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl বিশেষজ্ঞ" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "ভূচিত্ৰাৱলী ছবিসমূহ ডাম্প কৰক" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "এটা ছবি নথিপত্ৰলে গাঁথনি ভূচিত্ৰাৱলী পৰিৱৰ্তনসমূহ ডাম্প কৰক" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "গাঁথনি ভূচিত্ৰাৱলী অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "গাঁথনি ভূচিত্ৰাৱলীৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "লিখনী আৰু ছবিসমূহৰ মাজৰ গাঁথনি ভূচিত্ৰাৱলী অংশীদাৰী অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "গাঁথনি অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "কোনো আদিমৰ গাঁথনিকৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "arbfp অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "ARB অংশ প্ৰগ্ৰাসমূহৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "অসামৰ্থবান ঠিক কৰা হল" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "ঠিক কৰা ফলন পাইপলাইন বেকএণ্ডৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "GLSL অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "GLSL ৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "মিশ্ৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "মিশ্ৰণৰ ব্যৱহাৰ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "non-power-of-two গাঁথনি অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "চফ্টৱেৰ ক্লিপিং অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "চফ্টৱেৰত কিছুমান আয়ত ক্লিপ কৰাৰ Cogl ৰ চেষ্টা অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "উৎস দেখুৱাওক" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "সৃজন কৰা ARBfp/GLSL উৎস ক'ড দেখুৱাওক" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "কিছুমান OpenGL অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "কিছুমান নিৰ্বাচিত OpenGL কলসমূহ অনুকৰণ কৰে" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "অফস্ক্ৰিণ সমৰ্থন অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "অপস্ক্ৰিন সমৰ্থন ডিবাগ কৰক" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "প্ৰগ্ৰাম ক্যাশসমূহ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "arbfp আৰু glsl প্ৰগ্ৰামসমূহৰ বাবে ফলবেক ক্যাশসমূহ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "পঢ়া পিক্সেল অনুকূলীকৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "অস্বচ্ছ আয়তসমূহৰ সাধাৰণ ছবিসমূহৰ বাবে 1px পঢ়াৰ অনুকূলীকৰণ অসামৰ্থবান কৰক" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "ক্লিপিং অনুকৰণ কৰক" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl এ কিধৰণে ক্লিপিং প্ৰণয়ন কৰি আছে তাৰ বিষয়ে তথ্য লগ কৰে" diff --git a/po/ast.gmo b/po/ast.gmo new file mode 100644 index 0000000..7f825f7 Binary files /dev/null and b/po/ast.gmo differ diff --git a/po/ast.po b/po/ast.po new file mode 100644 index 0000000..d5a8b63 --- /dev/null +++ b/po/ast.po @@ -0,0 +1,339 @@ +# Asturian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Xandru Armesto , 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Opciones de depuración de Cogl qu'activar" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Opciones de depuración de Cogl que desactivar" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opciones de Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Amosar les opciones de Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/be.gmo b/po/be.gmo new file mode 100644 index 0000000..c76eb98 Binary files /dev/null and b/po/be.gmo differ diff --git a/po/be.po b/po/be.po new file mode 100644 index 0000000..3ee1f29 --- /dev/null +++ b/po/be.po @@ -0,0 +1,345 @@ +# Ihar Hrachyshka , 2011. +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-02-18 23:12+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:173 +msgid "Supported debug values:" +msgstr "Вядомыя адладачныя значэнні:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Спецыяльныя адладачныя значэнні:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Уключыць усе непаводзінныя адладачныя параметры" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Патрэбныя адладачныя сцяжкі Cogl" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Непатрэбныя адладачныя сцяжкі Cogl" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Опцыі Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Паказаць опцыі Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Трасіраванне Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Адсылкі CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Адладжваць праблемы з лічэннем спасылак для CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Трасіраваць нарэзку тэкстур" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "адладжваць стварэнне зрэзаў тэкстур" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Трасіраваць атласныя тэкстуры" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Адладжваць кіраванне атласам тэкстур" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Трасіраваць бленд-стрынгі" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Адладжваць разбор CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Трасіраваць журнал" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Праглядаць усе геаметрыі, якія праходзяць праз журнал" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Трасіраваць пакетаванне" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Паказваць, як геаметрыя пакетуецца ў журнале" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Трасіраваць матрыцы" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Трасіраваць усе матрычныя маніпуляцыі" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Трасіраваць рысаванне" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Трасіраваць разнастайныя рысавальныя аперацыі" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Трасіраваць рэндэрны модуль Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Трасіраваць рэндэрны модуль Cogl Pango" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Трасіраваць бэкэнд CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Трасіраваць бэкэнд растравых тэкстур Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Візуалізаваць" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Вылучыць прамавугольнікі" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Дадаць каркас для ўсёй прамавугольнай геаметрыі" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Паказаць каркас" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Дадаць каркас для ўсёй геаметрыі" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Корань праблемы" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Выключыць журнальнае пакетаванне" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Выключыць пакетаванне геаметрыі ў журнале Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Выключыць вяршынныя буферы GL" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Выключыць выкарыстанне аб'ектаў вяршынных буфераў OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Выключыць піксельныя буферы GL" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Выключыць выкарыстанне аб'ектаў піксельных буфераў OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Выключыць праграмную трансфармацыю прамавугольнікаў" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Выкарыстоўваць GPU для трансфармацыі прамавугольнай геаметрыі" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Спецыяліст Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Стварыць атласны файл вобразу" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Стварыць файл вобразу са зменамі атласнай тэкстуры" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Выключыць атласаванне тэкстур" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Выключыць выкарыстанне" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Выключыць супольнае выкарыстанне атласнай тэкстуры паміж тэкстам і выявамі" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "Выключыць тэкстураванне" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Выключыць тэкстураванне любых прымітываў" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Выключыць arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Выключыць выкарыстанне праграм з ARB-фрагментамі" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Выключыць фіксаваны канвеер" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Выключыць выкарыстанне бэкэнда з фіксаваным канвеерам функцый" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Выключыць GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Выключыць выкарыстанне GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Выключыць блендынг" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Выключыць блендынг" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Выключыць тэкстуры не другой ступені" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Выключыць праграмнае абразанне" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Выключыць спробы Cogl абрэзаць некаторыя прамавугольнікі ў праграмным рэжыме." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Паказаць выточны код" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Паказаць згенераваны выточны код ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Трасіраваць некаторыя функцыі OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Трасіраваць некаторыя выклікі OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Трасіраваць падтрымку пазаэкраннага рэндэрынгу" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Адладжваць падтрымку пазаэкраннага рэндэрынгу" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Выключыць праграмны кэш" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Выключыць дапаможны кэш для праграм arbfp і glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Выключыць аптымізацыю чытання піксела" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Выключыць аптымізацыю для чытання аднаго піксела ў простых сцэнах з " +"непразрыстымі прамавугольнікамі" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Трасіраваць кліпінг" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Запісваць звесткі аб тым, як Cogl рэалізуе кліпінг" diff --git a/po/bg.gmo b/po/bg.gmo new file mode 100644 index 0000000..4a2400b Binary files /dev/null and b/po/bg.gmo differ diff --git a/po/bg.po b/po/bg.po new file mode 100644 index 0000000..d83adb7 --- /dev/null +++ b/po/bg.po @@ -0,0 +1,369 @@ +# 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 master\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-07 06:25+0200\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:173 +msgid "Supported debug values:" +msgstr "Поддържани нива на съобщенията за отстраняване на грешки:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Специални нива на съобщенията за отстраняване на грешки:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" +"Включване на всички флагове за изчистване на грешки освен тези за поведението" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Флагове за отстраняване на грешки, които да се включат" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Флагове за отстраняване на грешки, които да се изключат" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Опции на Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Показване на опциите на Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Трасиране на Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Указатели към програмни обекти от вида „CoglObject“" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" +"Съобщения за отстраняване на грешки свързани с отчета на указателите към " +"програмни обекти от вида „CoglObject“" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Трасиране на разрязването на текстури" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" +"Съобщения за отстраняване на грешки свързани със създаването на отрязъци от " +"текстури" + +# Става въпрос за изображения съдържащи всички текстури. +# https://en.wikipedia.org/wiki/Texture_atlas +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Трасиране на атласите с текстури" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" +"Съобщения за отстраняване на грешки свързани с управлението на атласите с " +"текстури" + +# Става въпрос за специален формат низове в cogl, чрез които се задават +# правилата, на комбиниране на текстурите – събиране, изваждане, +# умножение и др. +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Трасиране на смесващите низове" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" +"Съобщения за отстраняване на грешки свързани с анализирането на " +"„CoglBlendString“" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Журнал на трасирането" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Преглед на геометрията, минаваща през журнала" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Трасиране на пакетирането" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Показване на пакетирането за обработка на геометрията в журнала" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Трасиране на матрици" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" +"Съобщения за отстраняване на грешки свързани с операциите по обработка на " +"матриците" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Трасиране на разни функции за изчертаване" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" +"Съобщения за отстраняване на грешки свързани с разни операции по изчертаване" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Трасиране на изобразяването чрез Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" +"Съобщения за отстраняване на грешки свързани с изобразяването чрез Pango" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" +"Трасиране на подсистемата за обработка на текстури в паметта " +"(CoglTexturePixmap)" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" +"Съобщения за отстраняване на грешки свързани с подсистемата на Cogl за " +"oбработка на текстури в паметта" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Онагледяване" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Очертаване на правоъгълниците" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Очертаване на геометрията по правоъгълници" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Показване на контури" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Очертаване на контурите на всички обекти" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Първопричина" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Изключване на пакетирането в журнала" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Изключване на обработката по пакети на геометрията в журнала на Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Изключване на буферирането на върховете в GL" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Изключване на обектите за буфериране на върхове в OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Изключване на буферирането на пикселите в GL" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Изключване на обектите за буфериране на пиксели в OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Изключване на софтуерните трансформации по правоъгълници" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" +"Трансформациите по правоъгълници да се извършват от графичния процесор (GPU)" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Инструментариум на Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Записване на изображенията с атласите" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Записване на промените в атласите с текстури във файл" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Изключване на атласите с текстури" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Изключване на използването на атласи с текстури" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" +"Изключване на споделянето на атласите с текстури между изображения и текст" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "Изключване на текстурите" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Изключване на текстурите за всички обекти" + +#: cogl/cogl-debug-options.h:129 +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:130 +msgid "Disable use of ARB fragment programs" +msgstr "Спиране на използването на програмите за обработка на фрагменти на ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Спиране на непроменяемите" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Спиране на ползването на ядрото с установени функции" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Изключване на GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Изключване на езика за графични програми на OpenGL (GLSL)" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Изключване на смесването" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Изключване на смесване" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Ползване само на текстури с размери степен на двойката" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Изключване на софтуерното изрязване" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Изключване на опитите на Cogl да изрязва софтуерно някои правоъгълници" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Показване на кода" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Показване на генерирания код на ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Трасиране на OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Трасиране на определени извиквания на OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Трасиране на поддръжката на буферите извън екрана" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Изчистване на грешките на поддръжката на буферите извън екрана" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Изключване на кеширането на програмите" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Изключване на резервното кеширане на програмите arbfp и glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Изключване на оптимизациите при четене на пиксели" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Изключване на оптимизациите за прочитане на области от по 1 пиксел за прости " +"сцени с непрозрачни правоъгълници" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Трасиране на изрязването" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +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 0000000..2223862 Binary files /dev/null and b/po/ca.gmo differ diff --git a/po/ca.po b/po/ca.po new file mode 100644 index 0000000..4282730 --- /dev/null +++ b/po/ca.po @@ -0,0 +1,337 @@ +# 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. +# +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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-15 21:06+0100\n" +"Last-Translator: Laura Balbastre Soler \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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Senyaladors de depuració del Cogl a definir" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Senyaladors de depuració del Cogl dels quals desfer-ne la definició" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opcions del Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Mostra les opcions del Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/ca@valencia.gmo b/po/ca@valencia.gmo new file mode 100644 index 0000000..561ed7c Binary files /dev/null and b/po/ca@valencia.gmo differ diff --git a/po/ca@valencia.po b/po/ca@valencia.po new file mode 100644 index 0000000..5017b32 --- /dev/null +++ b/po/ca@valencia.po @@ -0,0 +1,337 @@ +# 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. +# +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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-15 21:06+0100\n" +"Last-Translator: Laura Balbastre Soler \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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Senyaladors de depuració del Cogl a definir" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Senyaladors de depuració del Cogl dels quals desfer-ne la definició" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opcions del Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Mostra les opcions del Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/cogl.pot b/po/cogl.pot new file mode 100644 index 0000000..8fa13ae --- /dev/null +++ b/po/cogl.pot @@ -0,0 +1,337 @@ +# 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.10.2\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/cs.gmo b/po/cs.gmo new file mode 100644 index 0000000..dc388cb Binary files /dev/null and b/po/cs.gmo differ diff --git a/po/cs.po b/po/cs.po new file mode 100644 index 0000000..721e618 --- /dev/null +++ b/po/cs.po @@ -0,0 +1,344 @@ +# Czech translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# Marek Černocký , 2011. +# Adam Matoušek , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-02-24 19:57+0100\n" +"Last-Translator: Adam Matoušek \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:173 +msgid "Supported debug values:" +msgstr "Podporované ladicí hodnoty:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Speciální ladicí hodnoty:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Ladicí příznaky Cogl, které se mají nastavit" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Ladicí příznaky Cogl, jejichž nastavení se má zrušit" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Přepínače Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Zobrazit přepínače Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Sledování Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Odkazy CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Sledovat plátování textur" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "ladit tvorbu texturových plátů" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Sledovat atlasové textury" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Ladit správu texturového atlasu" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Sledovat matice" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Sledovat veškerou manipulaci s maticemi" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Sledovat různá kreslení" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Sledovat některé různorodé kreslící operace" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Sledovat vykreslování Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Sledovat vykreslování Cogl Pango" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Sledovat výkonné jádro CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Sledovat výkoné jádro pixmapových textur Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Vizualizovat" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Obrysové obdélníky" + +#: cogl/cogl-debug-options.h:79 +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:83 +msgid "Show wireframes" +msgstr "Drátěné zobrazení" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Přidat drátěný obrys ke všem útvarům" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Zakázat softwarovou transformaci obdélníků" + +#: cogl/cogl-debug-options.h:104 +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:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Ukládat obrázky atlasu" + +#: cogl/cogl-debug-options.h:109 +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:113 +msgid "Disable texture atlasing" +msgstr "Zakázat atlasování textur" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Zakázat tvorbu atlasu z textur" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Zakázat potažení texturami" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Zakázat potažení texturami u všech primitiv" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Zakázat arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Zakázat použití fragmentovacích programů ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Zakázat GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Zakázat používaní GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Zakázat mísení" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Zakázat použití mísení (blending)" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Zakázat textury typu NPOT" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Zakázat softwarové ořezávání" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Zobrazit zdrojový kód" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Zobrazit vytvořený zdrojový kód ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Sledovat něco z OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Sledovat některá vybraná volání OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Sledovat podporu mimoobrazovkového vykreslování" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Ladit podporu mimoobrazovkévého vykreslování (offscreen)" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Zakázat mezipaměť programů" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Zakázat nouzovou mezipaměť pro programy arbfp a glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Sledovat ořezávání" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Zapisovat informace, jak Cogl provádí ořezy" diff --git a/po/da.gmo b/po/da.gmo new file mode 100644 index 0000000..8b5763b Binary files /dev/null and b/po/da.gmo differ diff --git a/po/da.po b/po/da.po new file mode 100644 index 0000000..b78a98b --- /dev/null +++ b/po/da.po @@ -0,0 +1,347 @@ +# 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. +# +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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-02-19 19:04+0100\n" +"Last-Translator: Kenneth Nielsen \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:173 +msgid "Supported debug values:" +msgstr "Understøttede fejlfindingsværdier:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Specielle fejlfindingsværdier:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Aktiverer alle ikke-opførsels-fejlfindingsvalgmuligheder" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl fejlfindingsflag der skal angives" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl fejlfindingsflag der skal fjernes" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl-tilvalg" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Vis Cogl-tilvalg" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl-sporing" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject-referencer" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Fejlfind referencetællingsproblemer for CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Spor teksturopskæring" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "fejlfind dannelsen af teksturskiver" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Spor atlasteksturer" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Fejlfind tekstur-atlashåndtering" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Spor blanding af strenge" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Fejlfind tolkning af CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Spor journal" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Se al geometri som passerer gennem journalen" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Spor gruppering" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Vis hvordan geometri som passerer gennem journalen grupperes" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Spor matricer" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Spor al matrixmanipulation" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Spor diverse tegneoperationer" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Spor visse generelle tegneoperationer" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Spor Pango-rendering" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Spor Cogls Pango-rendering" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Spor det underliggende CoglTexturePixmap-program" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Spor Cogls underliggende teksturpixmap-program" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualisér" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Omrids rektangler" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Tilføj trådomrids for alle rektangulære geometrier" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Vis trådrammer" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Tilføj trådomrids for alle geometrier" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Underliggende årsag" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Deaktivér journalgruppering" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Deaktivér gruppering af geometri i Cogl-journalen." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Deaktivér GL-hjørnebuffere" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Deaktivér brugen af OpenGL-hjørnebufferobjekter" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Deaktivér GL-pixelbuffere" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Deaktivér brugen af OpenGL-pixelbufferobjekter" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Deaktivér software-rekt.-transformation" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Brug GPU'en til at transformere rektangulær geometri" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl-specialist" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Smid atlasbilleder" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Smid teksturatlasændringer til en billedfil" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Deaktivér teksturatlasering" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Deaktivér brugen af teksturatlasering" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Deaktivér teksturering" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Deaktivér teksturering af alle primitive" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Deaktivér arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Deaktivér brugen af ARB-fragmentprogrammer" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Deaktivér fastlåste" + +#: cogl/cogl-debug-options.h:135 +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:139 +msgid "Disable GLSL" +msgstr "Deaktivér GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Deaktivér brugen af GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Deaktivér blanding" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Deaktivér brugen af blanding" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Deaktiver ikke-anden-potens-teksturer" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Deaktivér softwareklipning" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Vis kilde" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Vis genereret ARBfp/GLSL-kildekode" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Spor OpenGL delvist" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Spor visse udvalgte OpenGL-kald" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Spor uden-for-skærmen-understøttelse" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Fejlfind uden-for-skærmen-understøttelse" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Deaktivér programcacher" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Deaktivér reservecacher for arbfp- og glsl-programmer" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Deaktivér læs-pixel-optimering" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Spor klipning" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Logger information om hvordan Cogl implementerer klipning" diff --git a/po/de.gmo b/po/de.gmo new file mode 100644 index 0000000..429d672 Binary files /dev/null and b/po/de.gmo differ diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..d24b992 --- /dev/null +++ b/po/de.po @@ -0,0 +1,337 @@ +# German translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Wolfgang Stöggl , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-17 20:32+0200\n" +"Last-Translator: Wolfgang Stoeggl \n" +"Language-Team: German \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" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Zu setzende Cogl-Fehlerdiagnose-Flags" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Zurückzusetzende Cogl-Fehlerdiagnose-Flags" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl-Einstellungen" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl-Einstellungen anzeigen" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/el.gmo b/po/el.gmo new file mode 100644 index 0000000..6414231 Binary files /dev/null and b/po/el.gmo differ diff --git a/po/el.po b/po/el.po new file mode 100644 index 0000000..3b34d42 --- /dev/null +++ b/po/el.po @@ -0,0 +1,339 @@ +# 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. +# +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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-11-13 16:03+0200\n" +"Last-Translator: Simos Xenitellis \n" +"Language-Team: Greek \n" +"Language: el\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:173 +msgid "Supported debug values:" +msgstr "Υποστηριζόμενες τιμές εκσφαλμάτωσης:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Ενεργοποίηση σημαιών αποσφαλμάτωσης Cogl" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Απενεργοποίηση σημαιών αποσφαλμάτωσης Cogl" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Επιλογές Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Εμφάνιση επιλογών Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" 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 0000000..f0ea331 Binary files /dev/null and b/po/en_CA.gmo differ diff --git a/po/en_CA.po b/po/en_CA.po new file mode 100644 index 0000000..8877916 --- /dev/null +++ b/po/en_CA.po @@ -0,0 +1,337 @@ +# 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl debugging flags to set" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl debugging flags to unset" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl Options" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Show Cogl options" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/en_GB.gmo b/po/en_GB.gmo new file mode 100644 index 0000000..3a40550 Binary files /dev/null and b/po/en_GB.gmo differ diff --git a/po/en_GB.po b/po/en_GB.po new file mode 100644 index 0000000..9698847 --- /dev/null +++ b/po/en_GB.po @@ -0,0 +1,343 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-06 15:21+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:173 +msgid "Supported debug values:" +msgstr "Supported debug values:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Special debug values:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Enables all non-behavioural debug options" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl debugging flags to set" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl debugging flags to unset" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl Options" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Show Cogl options" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl Tracing" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject references" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Debug ref counting issues for CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Trace Texture Slicing" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "debug the creation of texture slices" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Trace Atlas Textures" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Debug texture atlas management" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Trace Blend Strings" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Debug CoglBlendString parsing" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Trace Journal" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "View all the geometry passing through the journal" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Trace Batching" + +#: cogl/cogl-debug-options.h:53 +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:57 +msgid "Trace matrices" +msgstr "Trace matrices" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Trace all matrix manipulation" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Trace Misc Drawing" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Trace some misc drawing operations" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Trace Pango Renderer" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Trace the Cogl Pango renderer" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Trace CoglTexturePixmap backend" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Trace the Cogl texture pixmap backend" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualise" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Outline rectangles" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Add wire outlines for all rectangular geometry" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Show wireframes" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Add wire outlines for all geometry" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Root Cause" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Disable Journal batching" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Disable batching of geometry in the Cogl Journal." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Disable GL Vertex Buffers" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Disable use of OpenGL vertex buffer objects" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Disable GL Pixel Buffers" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Disable use of OpenGL pixel buffer objects" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Disable software rect transform" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Use the GPU to transform rectangular geometry" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl Specialist" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Dump atlas images" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Dump texture atlas changes to an image file" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Disable texture atlasing" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Disable use of texture atlasing" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Disable texturing" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Disable texturing any primitives" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Disable arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Disable use of ARB fragment programs" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Disable fixed" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Disable use of the fixed function pipeline backend" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Disable GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Disable use of GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Disable blending" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Disable use of blending" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Disable non-power-of-two textures" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Disable software clipping" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Show source" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Show generated ARBfp/GLSL source code" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Trace some OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Traces some select OpenGL calls" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Trace offscreen support" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Debug offscreen support" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Disable program caches" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Disable fallback caches for arbfp and glsl programs" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Disable read pixel optimisation" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Trace clipping" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Logs information about how Cogl is implementing clipping" diff --git a/po/eo.gmo b/po/eo.gmo new file mode 100644 index 0000000..13b66cb Binary files /dev/null and b/po/eo.gmo differ diff --git a/po/eo.po b/po/eo.po new file mode 100644 index 0000000..399dd1d --- /dev/null +++ b/po/eo.po @@ -0,0 +1,337 @@ +# Esperanto translation for cogl. +# Copyright (C) 2011 Free Software Foundation, Inc. +# This file is distributed under the same license as the cogl package. +# Kristjan SCHMIDT , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-03 23:50+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" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Enŝaltotaj sencimig-flagoj de Cogl" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Elŝaltotaj sencimig-flagoj de Cogl" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opcioj de Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Montri la opciojn de Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/es.gmo b/po/es.gmo new file mode 100644 index 0000000..1c81232 Binary files /dev/null and b/po/es.gmo differ diff --git a/po/es.po b/po/es.po new file mode 100644 index 0000000..75ffe4c --- /dev/null +++ b/po/es.po @@ -0,0 +1,348 @@ +# 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. +# +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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-12-20 14:18+0100\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" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "Valores de depuración soportados:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Valores especiales de depuración:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Activa todas las opciones de depuración sin comportamiento" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Opciones de depuración de Cogl que activar" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Opciones de depuración de Cogl que desactivar" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opciones de Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Mostrar las opciones de Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Rastreo de Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Referencias de CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de conteo de referencias para CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Rastrear el troceado de texturas" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "depurar la creación de troceado de texturas" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Rastrear texturas atlas" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Gestión de la depuración de texturas atlas" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Rastrear cadenas de mezclado" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Análisis de depuración de CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Rastrear diario" + +#: cogl/cogl-debug-options.h:48 +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:52 +msgid "Trace Batching" +msgstr "Rastrear procesado por lotes" + +#: cogl/cogl-debug-options.h:53 +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:57 +msgid "Trace matrices" +msgstr "Rastrear matrices" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Rastrear toda la manipulación de matrices" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Rastrear dibujado variado" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Rastrear algunas operaciones de dibujado variadas" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Rastrear dibujado Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Rastrear el dibujado Pango de Cogl" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Rastrear el backend de CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +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:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Esbozar rectángulos" + +#: cogl/cogl-debug-options.h:79 +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:83 +msgid "Show wireframes" +msgstr "Mostrar trazados de líneas (wireframes)" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Añadir trazos de líneas para toda la geometría" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Causa raíz" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Desactivar el procesado por lotes en el diario" + +#: cogl/cogl-debug-options.h:89 +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:93 +msgid "Disable GL Vertex Buffers" +msgstr "Desactivar los búferes vertex de GL" + +#: cogl/cogl-debug-options.h:94 +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:98 +msgid "Disable GL Pixel Buffers" +msgstr "Desactivar los búferes de píxel GL" + +#: cogl/cogl-debug-options.h:99 +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:103 +msgid "Disable software rect transform" +msgstr "Desactivar la transformación de rectas por software" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Usar la GPU para transformar geometría rectangular" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Especialista de Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Volcar atlas de imágenes" + +#: cogl/cogl-debug-options.h:109 +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:113 +msgid "Disable texture atlasing" +msgstr "Desactivar los atlas de texturas" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Desactivar el uso de atlas de texturas" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Desactivar texturizado" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Desactivar el texturizado de cualquier primitiva" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Desactivar arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Desactivar el uso de programas de fragmentos ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Desactivar la función fija" + +#: cogl/cogl-debug-options.h:135 +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:139 +msgid "Disable GLSL" +msgstr "Desactivar GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Desactivar el uso de GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Desactivar la mezcla" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Desactivar el uso de la mezcla" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Desactivar las texturas que no sean potencias de dos" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Desactivar rectorte software" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Mostrar fuente" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostrar el código fuente ARBfp/GLSL generado" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Rastrear algunas OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Rastrea algunas llamadas OpenGL seleccionadas" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Rastrear soporte para fuera de la pantalla" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Depurar soporte para fuera de la pantalla" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Desactivar las cachés de los programas" + +#: cogl/cogl-debug-options.h:176 +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:180 +msgid "Disable read pixel optimization" +msgstr "Desactivar optimización de lectura de píxel" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Rastrear recortes" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Información de los registros acerca de cómo implementa Cogl los recortes" diff --git a/po/eu.gmo b/po/eu.gmo new file mode 100644 index 0000000..7a02c08 Binary files /dev/null and b/po/eu.gmo differ diff --git a/po/eu.po b/po/eu.po new file mode 100644 index 0000000..afd49fe --- /dev/null +++ b/po/eu.po @@ -0,0 +1,339 @@ +# 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. +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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-16 16:44+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: KBabel 1.11.4\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl arazketarako banderak ezartzeko" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl arazketarako banderak kentzeko" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl-en aukerak" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Erakutsi Cogl-en aukerak" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/fa.gmo b/po/fa.gmo new file mode 100644 index 0000000..12bfd38 Binary files /dev/null and b/po/fa.gmo differ diff --git a/po/fa.po b/po/fa.po new file mode 100644 index 0000000..b9ef78c --- /dev/null +++ b/po/fa.po @@ -0,0 +1,339 @@ +# Persian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Arash Mousavi , 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "پرچم‌های اشکال‌زدایی کوگل جهت تنظیم" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "پرچم‌های اشکال‌زدایی کوگل جهت خارج کردن از تنظیم" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "گزینه‌های کوگل" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "نمایش گزینه‌های کوگل" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/fr.gmo b/po/fr.gmo new file mode 100644 index 0000000..005c43a Binary files /dev/null and b/po/fr.gmo differ diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..73cd709 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,350 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-20 20:56+0100\n" +"Last-Translator: Bruno Brouard \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:173 +msgid "Supported debug values:" +msgstr "Valeurs de débogage prises en charge :" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Valeurs de débogage spéciales :" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Active toutes les options de débogage non-associées au comportement" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Drapeaux de débogage Cogl à définir" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Drapeaux de débogage Cogl à annuler" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Options Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Affiche les options Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Traçage de Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Références CoglObject" + +#: cogl/cogl-debug-options.h:28 +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:32 +msgid "Trace Texture Slicing" +msgstr "Tracer le découpage des texture" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "Débogue la création des tranches de texture" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Tracer les textures atlas" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Débogue la gestion des textures atlas" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Tracer les chaînes de Blend" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Débogue l'analyse des CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Tracer le journal" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Affiche toute la géométrie transmise au journal" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Tracer le traitement par lot" + +#: cogl/cogl-debug-options.h:53 +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:57 +msgid "Trace matrices" +msgstr "Tracer les matrices" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Trace toutes les manipulations de matrice" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Tracer les dessins divers" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Trace des opérations de dessin divers" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Tracer le rendu Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Trace le rendu Pango de Cogl" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Tracer le moteur CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Trace le moteur pixmap des textures Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualiser" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Entourer les rectangles" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Ajoute des contours filaires à toute géométrie rectangulaire" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Afficher les structures en mode filaire" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Ajoute des contours filaires à toute géométrie" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Cause principale" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Désactiver le traitement par lot du journal" + +#: cogl/cogl-debug-options.h:89 +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:93 +msgid "Disable GL Vertex Buffers" +msgstr "Désactiver les buffers des sommets GL" + +#: cogl/cogl-debug-options.h:94 +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:98 +msgid "Disable GL Pixel Buffers" +msgstr "Désactiver les buffers des pixels GL" + +#: cogl/cogl-debug-options.h:99 +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:103 +msgid "Disable software rect transform" +msgstr "Désactiver la transformation rectangulaire du logiciel" + +#: cogl/cogl-debug-options.h:104 +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:106 +msgid "Cogl Specialist" +msgstr "Spécialiste Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Vider les images de l'atlas" + +#: cogl/cogl-debug-options.h:109 +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:113 +msgid "Disable texture atlasing" +msgstr "Désactiver l'enregistrement dans l'atlas des textures" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Désactive l'utilisation de l'enregistrement dans l'atlas des textures" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Désactiver l'utilisation de texture" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Désactive l'utilisation de texture pour toute primitive" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Désactiver arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Désactive l'utilisation de programmes fragmentés ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Désactiver fixés" + +#: cogl/cogl-debug-options.h:135 +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:139 +msgid "Disable GLSL" +msgstr "Désactiver GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Désactive l'utilisation de GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Désactiver les mélanges" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Désactive l'utilisation des mélanges" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Désactiver les textures non-puissance de deux" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Désactiver la coupure logiciel" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Afficher la source" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Affiche le code source ARBfp/GLSL produit" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Tracer quelques OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Trace quelques appels OpenGL sélectionnés" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Tracer la prise en charge hors-écran" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Débogue la prise en charge hors-écran" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Désactiver les caches de programme" + +#: cogl/cogl-debug-options.h:176 +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:180 +msgid "Disable read pixel optimization" +msgstr "Désactiver l'optimisation de lecture de pixel" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Tracer la coupure" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Enregistre les informations sur la façon dont Cogl met en œuvre la coupure" diff --git a/po/gl.gmo b/po/gl.gmo new file mode 100644 index 0000000..5d1706b Binary files /dev/null and b/po/gl.gmo differ diff --git a/po/gl.po b/po/gl.po new file mode 100644 index 0000000..b07de1f --- /dev/null +++ b/po/gl.po @@ -0,0 +1,345 @@ +# 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. +# Fran Dieguez , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-01-15 01:14+0100\n" +"Last-Translator: Fran Dieguez \n" +"Language-Team: Galician \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:173 +msgid "Supported debug values:" +msgstr "Valores de depuración admitidos:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Valores de depuración especiais:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Actíva todas as opcións de depuración que non son de comportamento" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Opcións de depuración de Cogl que activar" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Opcións de depuración de Cogl que desactivar" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opcións de Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Mostrar as opcións de Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Traceado de Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Referencias de CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de conteo de referencias para CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Rastrexar o troceado de texturas" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "depurar a creación de troceado de texturas" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Rastrexar texturar atlas" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Xestión da depuración de texturas atlas" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Rastrexar cadeas de mesturado" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Análisis de depuración de CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Rastrexar diario" + +#: cogl/cogl-debug-options.h:48 +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:52 +msgid "Trace Batching" +msgstr "Rastrexar procesado por lotes" + +#: cogl/cogl-debug-options.h:53 +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:57 +msgid "Trace matrices" +msgstr "Rastrexar matrices" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Rastrexar toda a manipulación de matrices" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Rastrexar debuxado variado" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Rastrexar algunas operacións de debuxado variadas" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Rastrexar debuxado Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Rastrexar o debuxado Pango de Cogl" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Rastrexar o backend de CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Rastrexar o «backend» do mapa de píxeles da textura de Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Esbozar rectángulos" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Engadir trazos de liñas para toda a xeometría rectangular" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Mostrar trazados de liñas (wireframes)" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Engadir trazos de liñas para toda a xeometría" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Causa raíz" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Desactivar o procesado por lotes no diario" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Desactivar o procesado por lotes da geometría no diario de Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Desactivar os búferes vertex de GL" + +#: cogl/cogl-debug-options.h:94 +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:98 +msgid "Disable GL Pixel Buffers" +msgstr "Desactivar os búferes de píxel GL" + +#: cogl/cogl-debug-options.h:99 +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:103 +msgid "Disable software rect transform" +msgstr "Desactivar a transformación de rectas por software" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Usar a GPU para transformar xeometría rectangular" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Especialista de Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Volcar atlas de imaxes" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Volcar cambios na textura de atlas a un ficheiro de imaxe" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Desactivar os atlas de texturas" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Desactivar o uso de atlas de texturas" + +#: cogl/cogl-debug-options.h:118 +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:119 +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á estabelecido, a caché de glyph usará sempre unha textura " +"separada para o seu atlas. Doutro xeito, tentará compartir o atlas coas " +"imaxes." + +#: cogl/cogl-debug-options.h:124 +msgid "Disable texturing" +msgstr "Desactivar texturizado" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Desactivar texturizado de calquera primitiva" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Desactivar arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Desactivar o uso de programas de fragmentos ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Desactivar a función fixa" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Desactivar o uso do «backend» da tubería da función fixa" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Desactivar GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Desactivar o uso de GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Desactivar o mesturado" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Desactivar o uso do mesturado" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Desactivar as texturas que non sexan potencias de dous" + +#: cogl/cogl-debug-options.h:150 +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 driver de GL non admite texturas NPOT, polo que " +"creará texturas troceadas ou texturas con residuos" + +#: cogl/cogl-debug-options.h:155 +msgid "Disable software clipping" +msgstr "Desactiar recorte software" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Desativa os tentos de Cogl de recortar algúns rectángulos en software." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Mostrar fonte" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostrar o código fonte ARBfp/GLSL xerado" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Rastrexar algunhas OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Rastrea algunhas chamadas OpenGL seleccionadas" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Rastrexar a compatibilidade para fóra da pantalla" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Depurar a compatibilidade para fóra da pantalla" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Desactivar as cachés dos programas" + +#: cogl/cogl-debug-options.h:176 +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:180 +msgid "Disable read pixel optimization" +msgstr "Desactivar optimización de lectura de píxel" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desactivar a optimización de lectura de 1p para escenas simples de " +"rectángulos opacos" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Rastrexar recortes" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Rexistra información sobre como Cogl está implementando o clipping" diff --git a/po/he.gmo b/po/he.gmo new file mode 100644 index 0000000..ecc7242 Binary files /dev/null and b/po/he.gmo differ diff --git a/po/he.po b/po/he.po new file mode 100644 index 0000000..1197d54 --- /dev/null +++ b/po/he.po @@ -0,0 +1,345 @@ +# Hebrew translations for PACKAGE package. +# Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Yaron Shahrabani , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-10-22 15:09+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:173 +msgid "Supported debug values:" +msgstr "Supported debug values:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Special debug values:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Enables all non-behavioural debug options" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl debugging flags to set" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl debugging flags to unset" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl Options" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Show Cogl options" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl Tracing" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject references" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Debug ref counting issues for CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Trace Texture Slicing" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "debug the creation of texture slices" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Trace Atlas Textures" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Debug texture atlas management" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Trace Blend Strings" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Debug CoglBlendString parsing" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Trace Journal" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "View all the geometry passing through the journal" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Trace Batching" + +#: cogl/cogl-debug-options.h:53 +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:57 +msgid "Trace matrices" +msgstr "Trace matrices" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Trace all matrix manipulation" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Trace Misc Drawing" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Trace some misc drawing operations" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Trace Pango Renderer" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Trace the Cogl Pango renderer" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Trace CoglTexturePixmap backend" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Trace the Cogl texture pixmap backend" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualize" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Outline rectangles" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Add wire outlines for all rectangular geometry" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Show wireframes" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Add wire outlines for all geometry" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Root Cause" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Disable Journal batching" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Disable batching of geometry in the Cogl Journal." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Disable GL Vertex Buffers" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Disable use of OpenGL vertex buffer objects" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Disable GL Pixel Buffers" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Disable use of OpenGL pixel buffer objects" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Disable software rect transform" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Use the GPU to transform rectangular geometry" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl Specialist" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Dump atlas images" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Dump texture atlas changes to an image file" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Disable texture atlasing" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Disable use of texture atlasing" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Disable texturing" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Disable texturing any primitives" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Disable arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Disable use of ARB fragment programs" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Disable fixed" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Disable use of the fixed function pipeline backend" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Disable GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Disable use of GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Disable blending" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Disable use of blending" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Disable non-power-of-two textures" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Disable software clipping" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Show source" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Show generated ARBfp/GLSL source code" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Trace some OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Traces some select OpenGL calls" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Trace offscreen support" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Debug offscreen support" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Disable program caches" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Disable fallback caches for arbfp and glsl programs" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Disable read pixel optimization" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Trace clipping" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Logs information about how Cogl is implementing clipping" diff --git a/po/hi.gmo b/po/hi.gmo new file mode 100644 index 0000000..830f77b Binary files /dev/null and b/po/hi.gmo differ diff --git a/po/hi.po b/po/hi.po new file mode 100644 index 0000000..1a03a94 --- /dev/null +++ b/po/hi.po @@ -0,0 +1,342 @@ +# Hindi translation for cogl. +# Copyright (C) 2012 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# chandan kumar , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-22 18:15+0530\n" +"Last-Translator: chandankumar(ciypro) \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:173 +msgid "Supported debug values:" +msgstr "समर्थित डीबग मान:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "विशेष डीबग मानों:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "सभी गैर-व्यवहारिक डिबग विकल्प सक्रीय" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl डिबगिंग फ्लैग सेट किया जाना है" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl डिबगिंग फ्लैग अनसेट किया जाना है" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl विकल्प" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl विकल्प दिखाएँ" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl ट्रैस कर रहा है" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject सन्दर्भ" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects के लिए रेफ गणना मुद्दों डीबग करें" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "संरचना स्लाइसिंग संरचना स्लाइसिंग का पता लगायें" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "संरचना स्लाइस की रचना को डीबग करें" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "ऐटलस संरचना का पता लगायें" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "संरचना एटलस प्रबंधन को डीबग करें" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "मिश्रण लडियाँ का पता लगायें" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString पारसिंग डीबग करें" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "पत्रिका का पता लगायें" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "पत्रिका के माध्यम से गुजरते ज्यामिति को देखें" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "प्रचयन का पता लगायें" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "दिखाएँ कि कैसे पत्रिका में ज्यामिति का प्रचय किया जा रहा है" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "मेट्रिसेस ट्रेस करें" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "सारे मैट्रिक्स परिवर्तन ट्रेस करें" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "विभिन्न आरेखण को ट्रेस करें" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "कुछ विभिन्न आरेखण संचालन को ट्रेस करें" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Pango Renderer को ट्रेस करें" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl Pango renderer को ट्रेस करें" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Cogl बनावट पिक्समेप बैकएंड को ट्रेस करें" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl बनावट पिक्समेप बैकएंड को ट्रेस करें" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "कल्पना करें" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "आयतों की रूपरेखा" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "सारे आयताकार ज्यामिति के लिए तार रूपरेखा जोड़ें" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "wireframes दिखाएँ" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "सारे ज्यामिति के लिए तार रूपरेखा जोड़ें" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "मूल कारण" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "पत्रिका प्रचयन अक्षम करें" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl पत्रिका में ज्यामिति के प्रचय अक्षम करें." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "GL शीर्ष उद्धरण को अक्षम करें" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "GL शीर्ष उद्धरण ऑब्जेक्ट के प्रयोग को अक्षम करें" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "GL पिक्सेल उद्धरण अक्षम करें" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "GL पिक्सेल उद्धरण ऑब्जेक्ट के प्रयोग को अक्षम करें" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "सॉफ़्टवेयर रेक्ट बदलना अक्षम करें" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "आयताकार ज्यामिति रूपांतरण हेतु GPU का उपयोग करें" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "cogl विशेषज्ञ" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "एटलस के छवियों को डंप करें" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "एटलस के संरचना को छवि फाइल में बदल कर डंप करें" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "संरचना atlasing निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "संरचना atlasing के उपयोग हेतु निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "पाठ और छवियों के बीच एटलस की संरचना को साझा करने के लिए निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "टेक्सचरिंग निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "कोई पुरातन टेक्सचरिंग निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "arbfp अक्षम" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "ARB खंडित प्रोग्राम्स के उपयोग हेतु निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "तय निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "निश्चित फ़ंक्शन पाइपलाइन बैकएंड का उपयोग निष्क्रिय करें" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "GLSL अक्षम" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "GLSL का उपयोग अक्षम" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "ब्लेंडिंग अक्षम" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "ब्लेंडिंग का उपयोग अक्षम" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "दो संरचना के गैर सत्ता को अक्षम करें" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "सॉफ़्टवेयर क्लिपिंग अक्षम" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Cogl द्वारा सॉफ़्टवेयर में कुछ आयतों को क्लिप करने के प्रयास को अक्षम करता है." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "स्रोत दिखाएँ" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "उत्पन्न ARBfp/GLSL स्रोत कोड दिखाएँ" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "कुछ OpenGL को ट्रेस करें" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "कुछ चयनित OpenGL कॉलस को ट्रेस करें" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "offscreen समर्थन को ट्रेस करें" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "offscreen समर्थन को डिबग करें" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "प्रोग्राम कैश अक्षम करें" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "arbfp और glsl प्रोग्राम्स के लिए प्रोग्राम कैश अक्षम करें" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "पिक्सेल अनुकूलन के पढने हेतु अक्षम करें" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "अपारदर्शी आयत की सरल दृश्यों के लिए 1px पढ़ने के लिए अनुकूलन को अक्षम करें" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "क्लिपिंग ट्रेस करें" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl क्लिपिंग को कैसे लागू कर है के बारे में जानकारी लॉग्स करें" diff --git a/po/hu.gmo b/po/hu.gmo new file mode 100644 index 0000000..9ef072f Binary files /dev/null and b/po/hu.gmo differ diff --git a/po/hu.po b/po/hu.po new file mode 100644 index 0000000..8a7d4e6 --- /dev/null +++ b/po/hu.po @@ -0,0 +1,347 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-23 11:56+0100\n" +"Last-Translator: Gabor Kelemen \n" +"Language-Team: Magyar \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:173 +msgid "Supported debug values:" +msgstr "Támogatott hibakeresési értékek:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Speciális hibakeresési értékek:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +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:226 +msgid "Cogl debugging flags to set" +msgstr "Beállítandó Cogl hibakereső jelzők" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Törlendő Cogl hibakereső jelzők" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl beállításai" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl beállításainak megjelenítése" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl követése" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject referenciák" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Referenciaszámlálási problémák hibakeresése CoglObject-ekhez" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Textúraszeletelés követése" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "textúraszeletek létrehozásának hibakeresése" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Atlas textúrák követése" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Textúrák Atlas-kezelésének hibakeresése" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Blend karakterláncok követése" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "A CoglBlendString feldolgozás hibakeresése" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Napló követése" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "A naplón átmenő összes geometria megjelenítése" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Kötegelés követése" + +#: cogl/cogl-debug-options.h:53 +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:57 +msgid "Trace matrices" +msgstr "Mátrixok követése" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Minden mátrixmanipuláció követése" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Egyéb rajzolás követése" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Néhány egyéb rajzolási művelet követése" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Pango megjelenítő követése" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "A Cogl Pango megjelenítő követése" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "A CoglTexturePixmap háttérprogram követése" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "A Cogl textúrabitkép háttérprogram követése" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Vizualizáció" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Téglalapok kiemelése" + +#: cogl/cogl-debug-options.h:79 +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:83 +msgid "Show wireframes" +msgstr "Drótvázak megjelenítése" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Drótvázkörvonalak hozzáadása minden geometriához" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Kiváltó ok" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Naplókötegelés letiltása" + +#: cogl/cogl-debug-options.h:89 +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:93 +msgid "Disable GL Vertex Buffers" +msgstr "GL vertexpufferek letiltása" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL vertexpuffer objektumok használatának letiltása" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "GL pixelpufferek letiltása" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL pixelpuffer objektumok használatának letiltása" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Szoftveres téglalap-átalakítás letiltása" + +#: cogl/cogl-debug-options.h:104 +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:106 +msgid "Cogl Specialist" +msgstr "Cogl specialista" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Atlas képek kiíratása" + +#: cogl/cogl-debug-options.h:109 +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:113 +msgid "Disable texture atlasing" +msgstr "Textúra Atlas letiltása" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Textúra Atlas használatának letiltása" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Textúrázás letiltása" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Primitívek textúrázásának letiltása" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Az arbfp letiltása" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "ARB töredékprogramok használatának letiltása" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Rögzített letiltása" + +#: cogl/cogl-debug-options.h:135 +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:139 +msgid "Disable GLSL" +msgstr "GLSL letiltása" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "A GLSL használatának letiltása" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Színátmenet letiltása" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Színátmenet használatának letiltása" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Nem kettő hatványa textúrák letiltása" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Szoftveres levágás letiltása" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Forrás megjelenítése" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Előállított ARBfp/GLSL forráskód megjelenítése" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Néhány OpenGL követése" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Néhány kiválasztott OpenGL hívás követése" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Képernyőn kívüli támogatás követése" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Képernyőn kívüli támogatás hibaelhárítása" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Programgyorsítótárak letiltása" + +#: cogl/cogl-debug-options.h:176 +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:180 +msgid "Disable read pixel optimization" +msgstr "Olvasási pixeloptimalizáció letiltása" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Vágás követése" + +#: cogl/cogl-debug-options.h:187 +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" diff --git a/po/id.gmo b/po/id.gmo new file mode 100644 index 0000000..d03a43e Binary files /dev/null and b/po/id.gmo differ diff --git a/po/id.po b/po/id.po new file mode 100644 index 0000000..5e40688 --- /dev/null +++ b/po/id.po @@ -0,0 +1,336 @@ +# Indonesian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Andika Triwidada , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-06 14:05+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" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Flag pengawakutuan Cogl untuk ditata" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Flag pengawakutuan Cogl untuk dibersihkan" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opsi Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Tampilkan opsi Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" 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 0000000..07bc809 Binary files /dev/null and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po new file mode 100644 index 0000000..120db7c --- /dev/null +++ b/po/it.po @@ -0,0 +1,337 @@ +# Italian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Luca Ferretti , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-02 23:51+0200\n" +"Last-Translator: Luca Ferretti \n" +"Language-Team: Italiano \n" +"Language: \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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Flag per il debug di Cogl da attivare" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Flag per il debug di Cogl da disattivare" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opzioni Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Mostra le opzioni Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/ja.gmo b/po/ja.gmo new file mode 100644 index 0000000..b557b4c Binary files /dev/null and b/po/ja.gmo differ diff --git a/po/ja.po b/po/ja.po new file mode 100644 index 0000000..37d776b --- /dev/null +++ b/po/ja.po @@ -0,0 +1,336 @@ +# cogl ja.po. +# Copyright (C) 2011 cogl's copyright holder +# This file is distributed under the same license as the cogl package. +# Takeshi AIHANA , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-07-03 18:47+0900\n" +"Last-Translator: Takeshi AIHANA \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" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "デバッグ・オプションを指定する" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "デバッグ・オプションを解除する" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl のオプション" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl のオプションを表示する" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/km.gmo b/po/km.gmo new file mode 100644 index 0000000..7b89212 Binary files /dev/null and b/po/km.gmo differ diff --git a/po/km.po b/po/km.po new file mode 100644 index 0000000..8c98a6e --- /dev/null +++ b/po/km.po @@ -0,0 +1,347 @@ +# 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "បំបាត់​កំហុស​តម្លៃ​ដែល​បាន​គាំទ្រ ៖" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "បំបាត់​កំហុស​តម្លៃ​ពិសេស ៖" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "បើក​​គ្រប់​ជម្រើស​បំបាត់​កំហុស​​​នៃ​ឥរិយា​ដែល​គ្មាន​ទាំងអស់" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "ទង់​ជាតិ​បំបាត់​កំហុស​​ Cogl ត្រូវ​កំណត់" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "ទង់ជាតិ​បំបាត់​កំហុស​មិន​ត្រូវ​កំណត់" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "ជម្រើស​របស់ Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "បង្ហាញ​ជម្រើស​របស់ Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "ការ​តាមដាន​​នៃ Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "សេចក្ដី​យោង​របស់ CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "បំបាត់​កំហុស​បញ្ហា​អំពី​ការ​រាប់​​​សេចក្ដី​យោង​សម្រាប់ CoglObjects" + +#: cogl/cogl-debug-options.h:32 +#, fuzzy +msgid "Trace Texture Slicing" +msgstr "ដាន​ក្នុង​ការ​កាត់​ជា​បន្ទះ​នៃ​​វាយនភាព" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "បំបាត់​កំហុស​ក្នុង​ការ​​កាត់​ជា​បន្ទះ​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "ដាន​វាយនភាព​សៀវភៅ​ផែនទី​" + +#: cogl/cogl-debug-options.h:38 +#, fuzzy +msgid "Debug texture atlas management" +msgstr "បំបាត់​កំហុស​ការ​គ្រប់គ្រង​សៀវភៅ​ផែនទី​​​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "ដាន​ល្បាយ​ខ្សែ​អក្សរ" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "កំហុស​ក្នុង​ការ​ញែក CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "ដាន​ទិនានុប្បវត្តិ​" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "មើល​គ្រប់​ការ​​ហុច​ធរណីមាត្រ​ទាំងអស់​តាម​ទិនានុប្បវត្តិ" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "ការ​ដាក់​ដាន​ជា​ក្រុម" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "បង្ហាញ​របៀប​ធរណីមាត្រ​ត្រូវ​បាន​ដាក់​ចំនួយ​ច្រើន​ក្នុង​ទិនានុប្បវត្តិ" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "ដាន​ម៉ាទ្រីស" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "ដាន​គ្រប់​ការ​ធ្វើ​ម៉ាទ្រីស​ទាំងអស់" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "ដាន​គំនូរ​ផ្សេងៗ" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "ដាន​ក្នុង​ការ​ប្រតិបត្តិ​ការ​គំនូរ​ផ្សេង​មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "ដាន​កម្មវិធី​បង្ហាញ Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "ដាន​កម្មវិធី​បង្ហាញ Cogl Pango" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "ដាន​កម្មវិធី​ខាងក្រោយ CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "ដាន​កម្មវិធី​ខាងក្រោយ Cogl texture pixmap" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "ធ្វើ​ឲ្យ​មើល​ឃើញ" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "ចតុកោណ​របស់​​គ្រោង" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "បន្ថែម​គ្រោង​ខ្សែ​សម្រាប់​ធរណីមាត្រ​ដែល​​​ជា​ចតុកោណ​ទាំងអស់" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "បង្ហាញ wireframes" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "បន្ថែម​​គ្រោង​ខ្សែ​សម្រាប់​ធរណីមាត្រ​ទាំងអស់" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "មូលហេតុ Root" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "បិទ​ការ​ដាក់​​​​ទិនានុប្បវត្តិ​ជា​ក្រុម" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "បិទ​ការ​ដាក់​ធរណីមាត្រ​ជា​ក្រុម​នៅ​ក្នុង​ទិនានុប្បវត្តិ​របស់ Cogl ។" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "បិទ​អង្គ​ចងចាំ​បណ្ដោះ​អាសន្ន​ផ្នែក​ខាងលើ​​របស់ GL" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ​​វត្ថុ​​​អង្គ​​​ចងចាំ​បណ្ដោះអាសន្ន​ផ្នែក​ខាងលើ​របស់ OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "បិទ​អង្គ​ចងចាំ​បណ្ដោះអាសន្ន​ភីកសែល​របស់ GL" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "បិទ​ការ​ប្រើប្រាស់​វត្ថុ​អង្គ​ចងចាំ​បណ្ដោះអាសន្ន​​ភីកសែល​របស់ OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "បិទ​​ការ​ប្លែង​ដែល​​ជា​ចតុកោណ​​​របស់​​កម្មវិធី ។" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "ប្រើ GPU ដើម្បី​ប្លែង​ធរណីមាត្រ​ដែល​​ជា​ចតុកោណ" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "អ្នក​ឯកទេស Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "បោះបង់​រូបភាព​នៃ​សៀវភៅ​ផែន​ទី" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "បោះបង់​ការ​ផ្លាស់ប្ដូរ​សៀវភៅ​ផែនទី​​វាយនភាព​ទៅកាន់​ឯកសារ​រូបភាព" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "បិទ​​ការ​ដាក់​​សៀវភៅ​ផែនទី​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ​​ការ​ដាក់​សៀវភៅ​ផែន​ទី​នៃ​វាយនភាព" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "បិទ​ការ​ចែករំលែក​​សៀវភៅ​ផែនទី​នៃ​វាយនភាព​រវាង​អត្ថបទ និង​រូបភាព" + +#: cogl/cogl-debug-options.h:119 +#, 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:124 +msgid "Disable texturing" +msgstr "បិទ​ការ​ធ្វើ​វាយនភាព" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "បិទ​ការ​ធ្វើ​វាយនភាព​​ជា​ដំបូង​មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "បិទ arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "បិទ​ការ​ប្រើប្រាស់​កម្មវិធី​បំណែក​របស់ ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "បិទ​ថេរ" + +#: cogl/cogl-debug-options.h:135 +#, fuzzy +msgid "Disable use of the fixed function pipeline backend" +msgstr "បិទ​ការ​ប្រើ​ប្រាស់​កម្មវិធី​ខាងក្រោយ pipeline នៃ​មុខងារ​ថេរ" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "បិទ GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "បិទ​ការ​លាយ" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "បិទ​ការ​ប្រើប្រាស់​នៃ​ការ​លាយ" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "បិទ​វាយនភាព​ពីរ​ដែល​គ្មាន​ថាមពល" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "បិទ​ការ​កាត់​​កម្មវិធី" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "បិទ​ការ​ប៉ុនប៉ង​របស់ Cogl ដើម្បី​កាត់​ចតុកោណ​មួយ​ចំនួន​នៅ​ក្នុង​កម្មវិធី ។" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "បង្ហាញ​ប្រភព" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "បង្ហាញ​កូដ​ប្រភព​របស់ ARBfp/GLSL ដែល​បាន​បង្កើត" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "ដាន OpenGL មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "ដាន​ជ្រើស​ការ​ហៅ OpenGL មួយ​ចំនួន" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "ការ​គាំទ្រ offscreen ​ដាន" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "បំបាត់​កំហុស​ការ​គាំទ្រ offscreen" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "បិទ​ឃ្លាំង​សម្ងាត់​របស់​កម្មវិធី" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "បិទ​ឃ្លាំង​សម្ងាត់​របស់ fallback សម្រាប់​កម្មវិធី arbfp និង glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "បិទ​ការ​អាន​ការ​ធ្វើ​ឲ្យ​ភីសែល​ល្អប្រសើរ" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "បិទ​ការ​ធ្វើ​ឲ្យ​ល្អ​​ប្រសើរ​ក្នុង​ការ​អាន ១ ភីសែល រូបភាព​សាមញ្ញ​នៃ​​ចតុកោណ​ស្រអាប់" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "ការ​កាត់​ដាន" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "ព័ត៌មាន​​កំណត់​ហេតុ​អំពី​របៀប​ Cogl ប្រតិបត្តិ​ការ​កាត់" diff --git a/po/kn.gmo b/po/kn.gmo new file mode 100644 index 0000000..1ad1236 Binary files /dev/null and b/po/kn.gmo differ diff --git a/po/kn.po b/po/kn.po new file mode 100644 index 0000000..68144a5 --- /dev/null +++ b/po/kn.po @@ -0,0 +1,338 @@ +# Kannada translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# Shankar Prasad , 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "ಹೊಂದಿಸಬೇಕಿರುವ Cogl ದೋಷ ನಿವಾರಣಾ ಗುರುತುಗಳು" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "ರದ್ದುಗೊಳಿಸಲಾದ Cogl ದೋಷ ನಿವಾರಣಾ ಗುರುತುಗಳು" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl ಆಯ್ಕೆಗಳು" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl ಆಯ್ಕೆಗಳನ್ನು ತೋರಿಸು" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/ko.gmo b/po/ko.gmo new file mode 100644 index 0000000..607f248 Binary files /dev/null and b/po/ko.gmo differ diff --git a/po/ko.po b/po/ko.po new file mode 100644 index 0000000..6163618 --- /dev/null +++ b/po/ko.po @@ -0,0 +1,337 @@ +# 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/lt.gmo b/po/lt.gmo new file mode 100644 index 0000000..c2d8182 Binary files /dev/null and b/po/lt.gmo differ diff --git a/po/lt.po b/po/lt.po new file mode 100644 index 0000000..3a222c6 --- /dev/null +++ b/po/lt.po @@ -0,0 +1,345 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-01-13 23:49+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:173 +msgid "Supported debug values:" +msgstr "Palaikomos derinimo reikšmės:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Specialios derinimo reikšmės:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Įjungia visas ne-elgsenos derinimo parinktis" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl derinimo požymiai įjungimui" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl derinimo požymiai išjungimui" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl parinktys" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Rodyti Cogl parinktis" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl sekimas" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject nuorodos" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Derinti nuorodų skaičiavimo problemas CoglObject'ams" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Sekti rašto kirpimus" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "derinti raštų iškarpų sukūrimus" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Sekti atlaso raštus" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Derinti raštų atlaso valdymą" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Sekti derinimo eilutes" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Derinti CoglBlendString skaitymą" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Sekti žurnalą" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Rodyti visą geometrijos perdavimą per žurnalą" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Sekti darbų partijas" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Rodyti, kaip geometrija grupuojama žurnale" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Sekti matricas" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Sekti visą matricų manipuliavimą" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Sekti įvairų piešimą" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Sekti dalį įvairių piešimo veiksmų" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Sekti Pango piešėją" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Sekti Cogl Pango piešėją" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Sekti CoglTexturePixmap realizaciją" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Sekti Cogl rašto pikselių žemėlapio realizaciją" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Pateikti" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Apibrėžti stačiakampius" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Apibrėžti visą stačiakampę geometriją" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Rodyti apibrėžimus" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Apibrėžti visą geometriją" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Pagrindinė priežastis" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Išjungti žurnalo grupavimą" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Išjungti geometrijos grupavimą Cogl žurnale" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Išjungti GL viršūnių buferius" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Išjungti OpenGL viršūnių buferių naudojimą" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Išjungti GL pikselių buferius" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Išjungti OpenGL pikselių buferių objektus" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Išjungti programinį stačiakampių transformavimą" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Naudoti GPU stačiakampės geometrijos transformavimui" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl specialistas" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Iškloti atlaso paveikslėlius" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Iškloti raštų atlaso pasikeitimus į paveikslėlio failą" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Išjungti raštų atlasą" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Išjungti raštų atlaso naudojimą" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Išjungti raštus" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Išjungti bet kokių primityvų raštus" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Išjungti arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Išjungti ARB fragmentų programų naudojimą" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Išjungti fiksuotą" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Išjungti fiksuotos funkcijos konvejerio realizacijos naudojimą" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Išjungti GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Išjungti GLSL naudojimą" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Išjungti derinimą" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Išjungti derinimo naudojimą" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Išjungti ne dvejeto laipsnių raštus" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Išjungti programinė karpymą" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Rodyti išeities tekstą" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Parodo sugeneruotą ARBfp/GLSL išeities tekstą" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Sekti dalį OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Seka kai kuriuos pasirinktus OpenGL kvietinius" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Sekti už ekrano palaikymą" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Derinti už ekrano palaikymą" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Išjungti programos podėlį" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Išjungti atsarginius podėlius arbfp ir glsl programoms" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Išjungti pikselių skaitymo optimizaciją" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Sekti karpymą" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Įrašo į žurnalą, kaip Cogl realizuoja karpymą" diff --git a/po/lv.gmo b/po/lv.gmo new file mode 100644 index 0000000..6087b3d Binary files /dev/null and b/po/lv.gmo differ diff --git a/po/lv.po b/po/lv.po new file mode 100644 index 0000000..f4c2ebb --- /dev/null +++ b/po/lv.po @@ -0,0 +1,338 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Rūdofls Mazurs , 2011. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-06 23:30+0300\n" +"Last-Translator: Rūdofls 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.1\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : " +"2);\n" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Iestatāmie Cogl atkļūdošanas karodziņi" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Noņemamie Cogl atkļūdošanas karodziņi" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl opcijas" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Rādīt Cogl opcijas" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/nb.gmo b/po/nb.gmo new file mode 100644 index 0000000..b388be6 Binary files /dev/null and b/po/nb.gmo differ diff --git a/po/nb.po b/po/nb.po new file mode 100644 index 0000000..af83ab6 --- /dev/null +++ b/po/nb.po @@ -0,0 +1,336 @@ +# 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-2012. +# +msgid "" +msgstr "" +"Project-Id-Version: cogl 1.9.4\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-01-24 15:03+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:173 +msgid "Supported debug values:" +msgstr "Støttede feilsøkingsverdier:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Spesielle feilsøkingsverdier:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Feilsøkingsflagg som skal settes for Cogl" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Feilsøkingsflagg som skal fjernes for Cogl" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Alternativer for Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Vis alternativer for Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl-sporing" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject-referanser" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualiser" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Rotårsak" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Slå av GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Slå av bruk av GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Vis kildekode" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/nl.gmo b/po/nl.gmo new file mode 100644 index 0000000..338a250 Binary files /dev/null and b/po/nl.gmo differ diff --git a/po/nl.po b/po/nl.po new file mode 100644 index 0000000..d5fdf71 --- /dev/null +++ b/po/nl.po @@ -0,0 +1,338 @@ +# 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "In te schakelen Cogl-debugvlaggen" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Uit te schakelen Cogl-debugvlaggen" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl-opties" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl-opties tonen" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/or.gmo b/po/or.gmo new file mode 100644 index 0000000..e81a0cc Binary files /dev/null and b/po/or.gmo differ diff --git a/po/or.po b/po/or.po new file mode 100644 index 0000000..ab07b79 --- /dev/null +++ b/po/or.po @@ -0,0 +1,338 @@ +# Oriya translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# Manoj Kumar Giri , 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "ସେଟ କରିବା ପାଇଁ Cogl ତ୍ରୁଟି ନିବାରଣ ପତାକାଗୁଡ଼ିକ" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "ସେଟ ନକରିବା ପାଇଁ Cogl ତ୍ରୁଟି ନିବାରଣ ପତାକାଗୁଡ଼ିକ" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl ବିକଳ୍ପଗୁଡିକ" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl ବିକଳ୍ପଗୁଡିକୁ ଦେଖାନ୍ତୁ" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/pa.gmo b/po/pa.gmo new file mode 100644 index 0000000..b8886e0 Binary files /dev/null and b/po/pa.gmo differ diff --git a/po/pa.po b/po/pa.po new file mode 100644 index 0000000..e75e59f --- /dev/null +++ b/po/pa.po @@ -0,0 +1,338 @@ +# Punjabi translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# A S Alam , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-04 17:00+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.2\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "ਸੈੱਟ ਕਰਨ ਲਈ Cogl ਡੀਬੱਗ ਫਲੈਗ" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "ਅਣ-ਸੈੱਟ ਕਰਨ ਲਈ Cogl ਡੀਬੱਗਿੰਗ ਨਿਸ਼ਾਨ" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl ਚੋਣਾਂ" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl ਚੋਣਾਂ ਵੇਖਾਓ" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/pl.gmo b/po/pl.gmo new file mode 100644 index 0000000..964423d Binary files /dev/null and b/po/pl.gmo differ diff --git a/po/pl.po b/po/pl.po new file mode 100644 index 0000000..01326a3 --- /dev/null +++ b/po/pl.po @@ -0,0 +1,351 @@ +# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +# 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 +# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +msgid "" +msgstr "" +"Project-Id-Version: cogl\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-09 19:43+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:173 +msgid "Supported debug values:" +msgstr "Obsługiwane wartości debugowania:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Specjalne wartości debugowania:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Włącza wszystkie opcje debugowania nie wpływające na zachowanie" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Flagi debugowania biblioteki Cogl do ustawienia" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Flagi debugowania biblioteki Cogl do usunięcia" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opcje biblioteki Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Wyświetla opcje biblioteki Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Śledzenie biblioteki Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Odniesienia CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Debuguje problemy liczenia odniesień dla CoglObject" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Śledzenie dzielenia tekstur" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "Debuguje tworzenie fragmentów tekstur" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Śledzenie tekstur atlas" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Debuguje zarządzanie teksturami atlas" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Śledzi ciągi mieszane" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Debuguje przetwarzanie CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Śledzenie dziennika" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Wyświetla wszystkie wymiary przechodzące przez dziennik" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Śledzenie przetwarzania" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Wyświetla, jak wymiary są przetwarzane w dzienniku" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Śledzenie macierzy" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Śledzi wszystkie zmiany macierzy" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Śledzenie różnego rysowania" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Śledzi różne działania rysowania" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Śledzenie mechanizmu wyświetlania Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Śledzi mechanizm wyświetlania Pango biblioteki Cogl" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Śledzenie mechanizmu CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Śledzi mechanizm map pikseli jako tekstur biblioteki Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Wyświetlanie" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Prostokąty obramowań" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Dodaje przewody obramowań dla wszystkich wymiarów prostokątnych" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Wyświetla ramki przewodów" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Dodaje przewody obramowań dla wszystkich wymiarów" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Główny powód" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Wyłączenie przetwarzania w dzienniku" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Wyłącza przetwarzanie wymiarów w dzienniku biblioteki Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Wyłączenie buforu werteksów GL" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Wyłącza użycie obiektów bufora werteksów OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Wyłączenie bufora pikseli GL" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Wyłącza użycie obiektów bufora pikseli OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Wyłączenie programowego przetwarzania prostokątów" + +#: cogl/cogl-debug-options.h:104 +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:106 +msgid "Cogl Specialist" +msgstr "Specjalista biblioteki Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Zrzucenie obrazów atlasu" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Zrzuca zmiany tekstur atlas do pliku obrazu" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Wyłączenie atlasowania tekstur" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Wyłącza użycie atlasowania tekstur" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Wyłączenie teksturowania" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Wyłącza teksturowanie wszystkich figur" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Wyłączenie arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Wyłącza użycie programów cząsteczkowych ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Wyłączenie stałego potoku" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Wyłącza użycie mechanizmu potoku stałych funkcji" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Wyłączenie GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Wyłącza użycie GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Wyłączenie mieszania" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Wyłącza użycie mieszania" + +#: cogl/cogl-debug-options.h:149 +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:150 +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:155 +msgid "Disable software clipping" +msgstr "Wyłączenie programowego skracania" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Wyświetlanie źródła" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Wyświetla utworzony kod źródłowy ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Śledzenie OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Śledzi wybrane wywołania OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Śledzenie obsługi poza ekranem" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Debuguje obsługę poza ekranem" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Wyłączenie pamięci podręcznych programów" + +#: cogl/cogl-debug-options.h:176 +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:180 +msgid "Disable read pixel optimization" +msgstr "Wyłączenie optymalizacji pikseli odczytu" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Śledzenie przycinania" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" +"Zapisuje informacje o tym, jak biblioteka Cogl implementuje przycinanie" diff --git a/po/pt.gmo b/po/pt.gmo new file mode 100644 index 0000000..050be67 Binary files /dev/null and b/po/pt.gmo differ diff --git a/po/pt.po b/po/pt.po new file mode 100644 index 0000000..b8f19df --- /dev/null +++ b/po/pt.po @@ -0,0 +1,343 @@ +# cogl's portuguese translation. +# Copyright © 2011, 2012 cogl +# This file is distributed under the same license as the cogl package. +# Duarte Loreto , 2011, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: 3.4\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-18 13:55+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:173 +msgid "Supported debug values:" +msgstr "Valores de depuração suportados:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Valores de depuração especiais:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Activa todas as opções de depuração não-comportamentais" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Parâmetros de depuração Cogl a definir" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Parâmetros de depuração Cogl a desactivar" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opções Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Apresentar as opções do Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Acompanhamento Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Referências CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de contagem de referências para CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Acompanhar Fatiamento de Texturas" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "Depurar a criação de fatias de texturas" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Acompanhar Texturas Atlas" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Depurar a gestão de texturas atlas" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Acompanhar Mistura de Expressões" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Depurar o processamento de CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Diário de Acompanhamento" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Visualizar toda a geometria a passar pelo diário" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Acompanhar Lotes" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Apresentar como a geometria é loteada no diário" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Acompanhar matrizes" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Acompanhar todas as manipulações de matrizes" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Acompanhar Miscelânea de Desenhos" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Acompanhar algumas operações de desenhos" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Acompanhar Renderizador Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Acompanhar o renderizador Pango do Cogl" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Acompanhar o motor de CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Acompanhar o motor de imagens de texturas do Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Delimitar rectângulos" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Adicionar delimitações a todas as geometrias rectangulares" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Apresentar contornos" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Adicionar contornos para todas as geometrias" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Motivo Inicial" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Desactivar Loteamento no Diário" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Desactivar o loteamento da geometria no Diário Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Desactivar Buffers GL Vertex" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Desactivar a utilização de objectos de buffer vertex OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Desactivar Buffer de Pixels GL" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Desactivar a utilização de objectos de buffer de pixels OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Desactivar a transformação de rectângulos pela aplicação" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Utilizar o Processador Gráfico para transformar geometria rectangular" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Especialista Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Despejar imagens atlas" + +#: cogl/cogl-debug-options.h:109 +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:113 +msgid "Disable texture atlasing" +msgstr "Desactivar atlas de texturas" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Desactivar a utilização de atlas de texturas" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Desactivar a partilha de texturas atlas entre texto e imagens" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "Desactivar texturas" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Desactivar texturas de quaisquer primitivas" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Desactivar arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Desactivar a utilização de aplicações de fragmentos ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Desactivar fixa" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Desactivar a utilização do motor de canal de função fixa" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Desactivar GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Desactivar a utilização do GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Desactivar mistura" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Desactivar a utilização de mistura" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Desactivar texturas que não sejam potência-de-dois" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Desactivar corte por aplicação" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" +"Desactiva a tentativa do Cogl de cortar na aplicação alguns rectângulos." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Apresentar fonte" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Apresenta o código fonte ARBfp/GLSL gerado" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Acompanhar algum OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Acompanha algumas chamadas OpenGL seleccionadas" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Acompanhar suporte fora do ecrã" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Depurar suporte fora do ecrã" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Desactivar caches da aplicação" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Desactivar caches de recurso para aplicações arbfp e glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Desactivar optimização de pixel lido" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Desactivar a optimização para leitura de 1px de cenas simples de rectângulos " +"opacos" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Acompanhar corte" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Regista informação sobre como o Cogl está a implementar o corte" diff --git a/po/pt_BR.gmo b/po/pt_BR.gmo new file mode 100644 index 0000000..237e0d8 Binary files /dev/null and b/po/pt_BR.gmo differ diff --git a/po/pt_BR.po b/po/pt_BR.po new file mode 100644 index 0000000..73d3133 --- /dev/null +++ b/po/pt_BR.po @@ -0,0 +1,350 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Flamarion Jorge , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-06 17:50-0300\n" +"Last-Translator: Enrico Nicoletto \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:173 +msgid "Supported debug values:" +msgstr "Valores de depuração suportados:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Valores especiais de depuração:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Habilita todas as opções de depuração não comportamentais" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Opções de depuração do Cogl a serem ativadas" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Opções de depuração do Cogl a serem desativadas" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opções do Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Mostrar opções do Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Rastreamento do Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Referências de CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Depurar problemas de contagem de referências para CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Rastrear fatiamento de texturas" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "depurar a criação de fatiamentos de textura" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Rastrear texturas atlas" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Gerenciamento de depuração de texturas atlas" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Rastrear mesclagem de Strings" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Análise de depuração do CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Rastrear diário" + +#: cogl/cogl-debug-options.h:48 +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:52 +msgid "Trace Batching" +msgstr "Rastrear o processamento de lotes" + +#: cogl/cogl-debug-options.h:53 +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:57 +msgid "Trace matrices" +msgstr "Rastrear matrizes" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Rastrear toda manipulação de matrizes" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Rastrear miscelânea de desenho" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Rastreia algumas operações variadas de desenho" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Rastrear renderizador Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Rastrear o renderizador Pango do Cogl" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Rastrear a retaguarda (backend) CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Rastreia a retaguarda (backend) da textura pixmap do Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualizar" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Contornar retângulos" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Adiciona contornos de linha para toda a geometria retângular" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Mostrar quadro de arame" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Adiciona contornos de linha para toda a geometria" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Causa raíz" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Desabilitar o processamento em lote do diário" + +#: cogl/cogl-debug-options.h:89 +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:93 +msgid "Disable GL Vertex Buffers" +msgstr "Desabilitar os buffers de vértices GL" + +#: cogl/cogl-debug-options.h:94 +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:98 +msgid "Disable GL Pixel Buffers" +msgstr "Desabilitar os buffers de píxel GL" + +#: cogl/cogl-debug-options.h:99 +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:103 +msgid "Disable software rect transform" +msgstr "Desabilitar a transformada de reta por software" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Utiliza a GPU para a transformar geometria retângular" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Especialista Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Descarregar imagens atlas" + +#: cogl/cogl-debug-options.h:109 +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:113 +msgid "Disable texture atlasing" +msgstr "Desabilitar texturas atlas" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Desabilita a utilização de texturas atlas" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Desabilitar texturização" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Desativar texturização de quaisquer primitivas" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Desabilitar arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Desabilitar a utilização de programas de fragmento ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Desabilitar fixado" + +#: cogl/cogl-debug-options.h:135 +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:139 +msgid "Disable GLSL" +msgstr "Desabilitar GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Desabilitar uso do GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Desabilita a mistura (blending)" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Desabilitar a utilização de mistura (blending)" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Desabilitar texturas que não sejam elevadas ao quadrado (^2)" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Desabilitar o recorte por software" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Exibir fonte" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Mostrar o código-fonte ARBfp/GLSL gerado" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Rastrear um pouco o OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Rastreia algumas chamadas selecionadas do OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Rastrear suporte fora da tela (offscreen)" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Realiza depuração de suporte fora da tela (offscreen)" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Desabilitar cache de programas" + +#: cogl/cogl-debug-options.h:176 +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:180 +msgid "Disable read pixel optimization" +msgstr "Desabilitar a otimização de leitura de píxel" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Rastrear recortes" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Registra informações sobre como Cogl está implementando recortes" 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 0000000..a0cf46e Binary files /dev/null and b/po/ru.gmo differ diff --git a/po/ru.po b/po/ru.po new file mode 100644 index 0000000..b8af7f9 --- /dev/null +++ b/po/ru.po @@ -0,0 +1,346 @@ +# Russian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Yuri Myasoedov , 2011. +# Vitteran , 2011. +# Yuri Kozlov , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-17 14:00+0400\n" +"Last-Translator: Yuri Kozlov \n" +"Language-Team: Russian \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:173 +msgid "Supported debug values:" +msgstr "Поддерживаемые значения отладки:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Специальные значения отладки:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Включить все внеповеденческие параметры отладки" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Отладочные флаги Cogl для установки" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Отладочные флаги Cogl для сброса" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Параметры Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Показать параметры Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Трассировка Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Ссылки CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Отладить подсчёт ссылок CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Трассировка нарезки текстур" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "отладка создания слоёв текстур" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Трассировка атласа текстур" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Отладка управления атласом текстур" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Трассировка смешанных строк" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Отладка разбора CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Журнал трассировки" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Показывать все фигуры, передаваемую через журнал" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Трассировка комплектации" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Показывать как фигуры комплектуется в журнале" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Трассировка матриц" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Трассировать все операции с матрицами" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Трассировка различных рисований" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Трассировать некоторые другие операции рисования" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Трассировка визуализатора Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Трассировать визуализатор Cogl Pango" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Трассировка обработчик CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Трассировать обработчик точечных карт текстур Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Визуализировать" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Очертить прямоугольниками" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Добавить контуры для всех прямоугольных фигур" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Показать контуры" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Добавить контуры для всех фигур" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Коренная причина" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Отключить журнал комплектации" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Отключить комплектацию фигур в журнале Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Выключить буферы GL Vertex" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Запретить использование вершинных буферных объектов OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Выключить буферы GL Pixel" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Запретить использование пиксельных буферных объектов OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Выключить программное преобразование прямоугольных координат" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Использовать GPU для преобразований прямоугольных координат" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Специалист Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Дамп атласа изображений" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Записать дамп изменений атласа текстур в файл изображений" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Выключить атлас текстур" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Не использовать атлас текстур" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Выключить общий атлас текстур между текстом и изображениями" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "Выключить текстурирование" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Выключить текстурирование примитивов" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Выключить arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Не использовать ARB-фрагменты программ" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Выключить постоянный обработчик" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Не использовать постоянный функциональный конвейерный обработчик" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Выключить GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Не использовать GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Отключить смешивание" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Отключить использование смешивания" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Выключить текстуры не степени двойки" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Выключить программное усечение" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Запретить Cogl пытаться усекать некоторые прямоугольники программно." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Показать исходный код" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Показать сгенерированный исходный код ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Частичная трассировка OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Трассировка некоторых выбранных вызовов OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Трассировка закадровой поддержки" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Отладка закадровой поддержки" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Выключить программные кэши" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Выключить запасные кэши для программ arbfp и glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Выключить оптимизацию чтения пикселя" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Выключить оптимизацию для чтения 1px на простых сценах с непрозрачными " +"прямоугольниками" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Трассировка усечения" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Протоколировать информацию о том, как Cogl реализует усечение" diff --git a/po/sl.gmo b/po/sl.gmo new file mode 100644 index 0000000..5eb236a Binary files /dev/null and b/po/sl.gmo differ diff --git a/po/sl.po b/po/sl.po new file mode 100644 index 0000000..6d44f93 --- /dev/null +++ b/po/sl.po @@ -0,0 +1,350 @@ +# Slovenian translations for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# Martin Srebotnjak , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-08 21:35+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:173 +msgid "Supported debug values:" +msgstr "Podprta določila razhroščevanja:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Posebna določila razhroščevanja:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Omogoči vse ne-prikazne možnosti razhroščevanja" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Zastavice razhroščevanja Cogl za nastavljanje" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Zastavice razhroščevanja Cogl za odstranitev" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Možnosti Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Pokaži možnosti Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Sledenje Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Sklici predmetov CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Razhroščevanje sklicev števca napak predmetov CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Sledi porezavi tekstur" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "razhroščevanje ustvarjanja porezav teksture" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Sledi teksturam nabora" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Razhroščevanje upravljanja nabora tekstur" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Sledi nizom zlivanja" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Razhroščevanje razčlenitev CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Sledi dnevniku" + +#: cogl/cogl-debug-options.h:48 +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:52 +msgid "Trace Batching" +msgstr "Sledi paketni obdelavi" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Pokaži paketno obdelavo geometrije predmetov v dnevniku" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Sledi matrikam" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Sledi vsem obdelavam matrik" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Sledi risanju" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Sledi nekaterim risarskim opravilom" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Sledi izrisovalniku Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Sledi izrisovalniku Cogl Pango" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Sledi zaledju CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Sledi zaledju sličic teksture Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Predoči" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Oriši pravokotnike" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Dodaj črtni oris geometriji risanim pravokotnim predmetom" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Pokaži črtne orise" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Dodaj črtni oris vsem risanim predmetom" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Korenski vzrok" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Onemogoči paketno obdelavo dnevnika" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Onemogoči paketno obdelovanje geometrije v dnevniku Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Onemogoči medpomnilnik točk GL" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Onemogoči uporabo točkovnega medpomnilnika predmetov OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Onemogoči medpomnilnik sličic GL" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Onemogoči uporabo medpomnilnika sličic predmetov OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Onemogoči programsko preoblikovanje pravokotnikov" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Uporabi GPE za preoblikovanje geometrije pravokotnih predmetov" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Specialist Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Izriši slike nabora tekstur" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Izriši spremembe nabora tekstur v slikovno datoteko" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Onemogoči zbiranje nabora tekstur" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Onemogoči uporabo zbiranja nabora tekstur" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Onemogoči sestavljanje nabora" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Onemogoči teksturiranje primitivov" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Onemogoči arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Onemogoči uporabo fragmentarnih programov ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Onemogoči določeno" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Onemogoči uporabo zaledja stalnih funkcij cevovoda" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Onemogoči GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Onemogoči uporabo GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Onemogoči zlivanje" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Onemogoči uporabo zlivanja" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Onemogoči nekvadratne teksture" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Onemogoči programski odrez" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Prikaži vir" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Pokaži ustvarjeno izvorno kodo ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Sledi delovanju OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Sledi nekaterim izbranim klicem OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Sledi podpori zunaj zaslona" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Razhroščevanje podpore zunaj zaslona" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Onemogoči predpomnilnike programa" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Onemogoči zasilne predpomnilnike za programe arbfp in glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Onemogoči prilagajanje branja sličic" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Sledi odrezovanju" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Beleži podatke podrobnosti o izvajanju odrezovanja s programom Cogl" diff --git a/po/sr.gmo b/po/sr.gmo new file mode 100644 index 0000000..8825d75 Binary files /dev/null and b/po/sr.gmo differ diff --git a/po/sr.po b/po/sr.po new file mode 100644 index 0000000..2eb420a --- /dev/null +++ b/po/sr.po @@ -0,0 +1,344 @@ +# Serbian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Мирослав Николић , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-02-24 21:06+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:173 +msgid "Supported debug values:" +msgstr "Подржане вредности прочишћавања:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Посебне вредности прочишћавања:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Укључује све не-понашајуће опције прочишћавања" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Коглове опције прочишћавања за постављање" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Коглове опције прочишћавања за уклањање" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Опције Когла" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Приказује опције Когла" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Коглово праћење" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Референце објекта Когла" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Прочишћава проблеме бројања референци за објекте Когла" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Прати исецање склопа" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "прочишћава стварање исечака склопа" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Прати склопове атласа" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Прочишћава управљање атласом склопа" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Прати ниске стапања" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Прочишћава обрађивање ниски стапања Когла" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Прати рукавац" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Прегледа све облике који пролазе кроз рукавац" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Прати груписање" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Приказује како облик бива груписан у рукавцу" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Прати матрице" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Прати сва руковања матрицом" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Прати мешано цртање" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Прати неке радње мешаног цртања" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Прати Панго исцртавача" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Прати Когл Панго исцртавача" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Прати позадинца мапе тачака склопа Когла" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Прати позадинца мапе тачака склопа Когла" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Обвидни" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Правоугаоници контуре" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Додаје жичане контуре за све правоугаоне облике" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Приказује жичане рамове" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Додаје жичане контуре за све облике" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Корени узрок" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Искључи груписање рукавца" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Искључује груписање облика у рукавцу Когла." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Искључи међумеморије врхунца ГЛ-а" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Искључује коришћење објеката међумеморије врхунца ОпенГЛ-а" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Искључи међумеморије тачке ГЛ-а" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Искључује коришћење објеката међумеморије тачке ОпенГЛ-а" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Искључи софтверско преображавање правоугаоника" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Користи графички процесор за преображавање правоугаоног облика" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Специјалиста Когла" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Ускладишти слике атласа" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Складишти измене атласа склопа у датотеку слике" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Искључи атласирање склопа" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Искључује употребу атласирања склопа" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Искључи дељење атласа склопа између текста и слика" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "Искључи приказ склопа" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Искључује приказ склопа било које основне функције" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Искључи арбфп" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Искључује употребу програма АРБ одломака" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Искључи сталну" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Искључује употребу позадинца спојке сталне функције" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Искључи ГЛСЛ" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Искључује употребу ГЛСЛ-а" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Искључи стапање" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Искључује употребу стапања" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Искључи склопове који нису степен двојке" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Искључи софтверско одсецање" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Искључује Коглове покушаје да одсече неке правоугаонике у софтверу." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Прикажи извор" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Приказује створени АРБфп/ГЛСЛ изворни код" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Прати неки ОпенГЛ" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Прати неке одабране позиве ОпенГЛ-а" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Прати ванекранску подршку" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Прочисти ванекранску подршку" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Искључи оставе програма" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Искључује оставе пребацивања за арбфп и глсл програме" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Искључи оптимизацију читања тачке" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Искључује оптимизацију за читање 1 тачке за једноставне сцене непрозирних " +"правоугаоника" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Прати одсецање" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Записује податке о томе како Когл примењује одсецање" diff --git a/po/sr@latin.gmo b/po/sr@latin.gmo new file mode 100644 index 0000000..cd013e9 Binary files /dev/null and b/po/sr@latin.gmo differ diff --git a/po/sr@latin.po b/po/sr@latin.po new file mode 100644 index 0000000..842ba49 --- /dev/null +++ b/po/sr@latin.po @@ -0,0 +1,344 @@ +# Serbian translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Miroslav Nikolić , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-02-24 21:06+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:173 +msgid "Supported debug values:" +msgstr "Podržane vrednosti pročišćavanja:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Posebne vrednosti pročišćavanja:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Uključuje sve ne-ponašajuće opcije pročišćavanja" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Koglove opcije pročišćavanja za postavljanje" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Koglove opcije pročišćavanja za uklanjanje" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Opcije Kogla" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Prikazuje opcije Kogla" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Koglovo praćenje" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Reference objekta Kogla" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Pročišćava probleme brojanja referenci za objekte Kogla" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Prati isecanje sklopa" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "pročišćava stvaranje isečaka sklopa" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Prati sklopove atlasa" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Pročišćava upravljanje atlasom sklopa" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Prati niske stapanja" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Pročišćava obrađivanje niski stapanja Kogla" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Prati rukavac" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Pregleda sve oblike koji prolaze kroz rukavac" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Prati grupisanje" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Prikazuje kako oblik biva grupisan u rukavcu" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Prati matrice" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Prati sva rukovanja matricom" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Prati mešano crtanje" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Prati neke radnje mešanog crtanja" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Prati Pango iscrtavača" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Prati Kogl Pango iscrtavača" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Prati pozadinca mape tačaka sklopa Kogla" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Prati pozadinca mape tačaka sklopa Kogla" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Obvidni" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Pravougaonici konture" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Dodaje žičane konture za sve pravougaone oblike" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Prikazuje žičane ramove" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Dodaje žičane konture za sve oblike" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Koreni uzrok" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Isključi grupisanje rukavca" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Isključuje grupisanje oblika u rukavcu Kogla." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Isključi međumemorije vrhunca GL-a" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Isključuje korišćenje objekata međumemorije vrhunca OpenGL-a" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Isključi međumemorije tačke GL-a" + +#: cogl/cogl-debug-options.h:99 +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:103 +msgid "Disable software rect transform" +msgstr "Isključi softversko preobražavanje pravougaonika" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Koristi grafički procesor za preobražavanje pravougaonog oblika" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Specijalista Kogla" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Uskladišti slike atlasa" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Skladišti izmene atlasa sklopa u datoteku slike" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Isključi atlasiranje sklopa" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Isključuje upotrebu atlasiranja sklopa" + +#: cogl/cogl-debug-options.h:118 +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:119 +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:124 +msgid "Disable texturing" +msgstr "Isključi prikaz sklopa" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Isključuje prikaz sklopa bilo koje osnovne funkcije" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Isključi arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Isključuje upotrebu programa ARB odlomaka" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Isključi stalnu" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Isključuje upotrebu pozadinca spojke stalne funkcije" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Isključi GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Isključuje upotrebu GLSL-a" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Isključi stapanje" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Isključuje upotrebu stapanja" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Isključi sklopove koji nisu stepen dvojke" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Isključi softversko odsecanje" + +#: cogl/cogl-debug-options.h:156 +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:160 +msgid "Show source" +msgstr "Prikaži izvor" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Prikazuje stvoreni ARBfp/GLSL izvorni kod" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Prati neki OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Prati neke odabrane pozive OpenGL-a" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Prati vanekransku podršku" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Pročisti vanekransku podršku" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Isključi ostave programa" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Isključuje ostave prebacivanja za arbfp i glsl programe" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Isključi optimizaciju čitanja tačke" + +#: cogl/cogl-debug-options.h:181 +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:186 +msgid "Trace clipping" +msgstr "Prati odsecanje" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Zapisuje podatke o tome kako Kogl primenjuje odsecanje" 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 0000000..5eed93c Binary files /dev/null and b/po/sv.gmo differ diff --git a/po/sv.po b/po/sv.po new file mode 100644 index 0000000..ecf6479 --- /dev/null +++ b/po/sv.po @@ -0,0 +1,336 @@ +# Swedish translation for cogl. +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. +# This file is distributed under the same license as the cogl package. +# Daniel Nylander , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-15 07:33+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:173 +msgid "Supported debug values:" +msgstr "Felsökningsvärden som stöds:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Speciella felsökningsvärden:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Felsökningsflaggor för Cogl att ställa in" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Felsökningsflaggor för Cogl att ta bort" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Flaggor för Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Visa flaggor för Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Felsök CoglBlendString-tolkning" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Visualisera" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Visa trådramar" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "Inaktivera texturering" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Inaktivera arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Inaktivera GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Inaktivera användning av GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Visa källkod" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/ta.gmo b/po/ta.gmo new file mode 100644 index 0000000..37caa2e Binary files /dev/null and b/po/ta.gmo differ diff --git a/po/ta.po b/po/ta.po new file mode 100644 index 0000000..856a104 --- /dev/null +++ b/po/ta.po @@ -0,0 +1,338 @@ +# Tamil translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# I Felix , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2011-09-08 11:11+0530\n" +"Last-Translator: I Felix \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.2\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl பிழைதிருத்துதல் கொடிகளை அமைக்கிறது" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl பிழைதிருத்துதல் கொடிகளை அமைத்தல்நீக்குகிறது" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl விருப்பங்கள்" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl விருப்பங்களை காட்டவும்" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/te.gmo b/po/te.gmo new file mode 100644 index 0000000..1af9fa7 Binary files /dev/null and b/po/te.gmo differ diff --git a/po/te.po b/po/te.po new file mode 100644 index 0000000..b90e00d --- /dev/null +++ b/po/te.po @@ -0,0 +1,343 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Sasi Bhushan Boddepalli, 2011. +# Krishnababu Krothapalli , 2012. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-21 22:01+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:173 +msgid "Supported debug values:" +msgstr "తోడ్పాటునిచ్చు డీబగ్ విలువలు:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "ప్రత్యేక డీబగ్ విలువలు:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "అన్ని ప్రవర్తన-లేని డీబగ్ ఐచ్చికాలను చేతనంచేయును" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl క్రమబద్దీకరించడానికి దోష నివారణ జెండాలు" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl క్రమరహిత పరచడానికి దోష నివారణ జెండాలు" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl ఇచ్ఛికాలు" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl ఇచ్ఛికాలను చూపుము" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl జాడపట్టుట" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject ప్రస్తావనలు" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects కొరకు డీబగ్ ప్రస్తావన లెక్కింపు సమస్యలు" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "టెక్చర్ స్లైసింగ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "టెక్చర్ స్లైసెస్ సృష్టీకరణ డీబగ్" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "అట్లాస్ టెక్చర్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "టెక్చర్ అట్లాస్ నిర్వహణ డీబగ్ చేయి" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "బ్లెండ్ స్ట్రింగ్స్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "CoglBlendString పదచ్ఛేదం(పార్శింగ్) డీబగ్ చేయి" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "జర్నల్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "జర్నల్ ద్వారా మొత్తం జ్యామితి పదచ్ఛేదం(పార్శింగ్) దర్శించు" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "బాచింగ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "జర్నల్ నందు జ్యామితి యెలా బాచ్‌డ్ చేయబడెనో చూపు" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "జాడ పట్టు మాట్రిసెస్" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "మొత్తం మాట్రిక్స్ నడుపుదల జాడ పట్టు" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "మిస్క్ చిత్రీకరణ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "కొన్ని మిస్క్ చిత్రీకరణ కార్యములను జాడ పట్టు" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "పాంగో రెండరర్‌ను జాడ పట్టు" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Cogl పాంగో రెండరర్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "CoglTexturePixmap బాకెండ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Cogl టెక్టర్ పిక్స్‌మాప్ బ్యాకెండ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "దృశ్యనీయం" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "ఆన్‌లైన్ దీర్ఘచతురస్త్రాలు" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "మొత్త దీర్ఘచతురస్త్ర జ్యామితికి వైర్ కట్టుగీతలు జతచేయి" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "వైర్‌చట్రములను చూపు" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "మొత్తం జ్యామితికి వైర్ కట్టుగీతలను జతచేయి" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "మూల కారణం" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "జర్నల్ బ్యాచింగ్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Cogl జర్నల్ నందు జ్యామితి బ్యాచింగ్ అచేతనంచేయి." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "GL వర్టెక్స్ బఫర్స్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "OpenGL వర్టెక్స్ బఫర్ వస్తువులు అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "GL పిగ్జెల్ బఫర్స్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "OpenGL పిగ్జెల్ బఫర్ వస్తువుల వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "సాఫ్టువేర్ రెక్ట్ బదలాయింపును అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "దీర్ఘచతురస్త్ర జ్యామితి బదలాయించుటకు GPU వుపయోగించు" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl నిపుణి" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "అట్లాస్ ప్రతిరూపాలను డంప్‌చేయి" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "టెక్చర్ అట్లాస్ మార్పులను ప్రతిరూప ఫైలునకు డంప్ చేయి" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "టెక్టర్ అట్లాసింగ్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "టెక్చర్ అట్లాసింగ్ వుపయోగంను అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "టెక్చర్ అట్లాస్‌ను పాఠము మరియు ప్రతిరూపముల మధ్య పంచుకొనుట అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "టెక్టరింగ్ అచేతనం చేయి" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "ఏ ధాతువుల టెక్చరింగైనా అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "arbfp అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "ARB ఫ్రాగ్‌మెంట్ ప్రోగ్రామ్స్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "నిర్దిష్టత అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "నిర్దిష్ట ప్రమేయ పైప్‌లైన్ బాకెండ్ వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "GLSL అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "GLSL వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "మిశ్రణం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "మిశ్రణం వుపయోగం అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "non-power-of-two టెక్చర్లు అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "సాఫ్టువేర్ క్లిప్పింగ్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "సాఫ్టువేర్ నందు కొన్ని దీర్ఘచతురస్త్రాలను క్లిప్ చేయుటకు Cogl యొక్క ప్రయత్నాలను అచేతనంచేయును." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "మూలమును చూపు" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "జనియింపచేసిన ARBfp/GLSL మూలపు కోడ్ చూపుము" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "OpenGL జాడ పట్టు" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "ఎంపికచేసిన OpenGL కాల్స్ జాడ పట్టును" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "offscreen తోడ్పాటు జాడ పట్టు" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "offscreen తోడ్పాటు డీబగ్ చేయి" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "ప్రోగ్రామ్ క్యాచీలను అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "arbfp మరియు glsl ప్రోగ్రామ్స్ కొరకు ఫాల్‌బాక్ క్యాచీలను అచేతనం చేయి" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "పిగ్జెల్ ఆప్టిమైజేషన్ చదువుట అచేతనం చేయి" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "అస్వచ్ఛ దీర్ఘచతురస్త్రాల సాదారణ సన్నివేశాల కొరకు 1px చదువుటకు ఆప్టిమైజేషన్ అచేతనంచేయి" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "క్లిప్పింగ్ జాడ పట్టు" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Cogl యెలా క్లిప్పింగ్ అమలుచేస్తోందో గురించిన లాగ్స్ సమాచారం" diff --git a/po/tr.gmo b/po/tr.gmo new file mode 100644 index 0000000..19df13c Binary files /dev/null and b/po/tr.gmo differ diff --git a/po/tr.po b/po/tr.po new file mode 100644 index 0000000..4c664d2 --- /dev/null +++ b/po/tr.po @@ -0,0 +1,338 @@ +# Turkish translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# +# Muhammet Kara , 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "Desteklenen hata ayıklama değerleri:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Özel hata ayıklama değerleri:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Atanacak Cogl hata ayıklama imleri" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Kaldırılacak Cogl hata ayıklama imleri" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl Seçenekleri" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl seçeneklerini göster" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/ug.gmo b/po/ug.gmo new file mode 100644 index 0000000..a18f7fa Binary files /dev/null and b/po/ug.gmo differ diff --git a/po/ug.po b/po/ug.po new file mode 100644 index 0000000..b1be937 --- /dev/null +++ b/po/ug.po @@ -0,0 +1,336 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-02-18 16:10+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Cogl نىڭ بەلگىلەيدىغان سازلاش تاللانمىلىرى" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Cogl نىڭ قىممىتى يوق قىلىنىدىغان سازلاش تاللانمىلىرى" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl تاللانمىلىرى" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Cogl تاللانمىلىرى كۆرسىتىش" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/uk.gmo b/po/uk.gmo new file mode 100644 index 0000000..09b67cf Binary files /dev/null and b/po/uk.gmo differ diff --git a/po/uk.po b/po/uk.po new file mode 100644 index 0000000..655796f --- /dev/null +++ b/po/uk.po @@ -0,0 +1,344 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Korostil Daniel , 2012. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" +"product=clutter\n" +"POT-Creation-Date: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-02-26 15:43+0300\n" +"Last-Translator: Korostil Daniel \n" +"Language-Team: translation@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.6.1\n" + +#: cogl/cogl-debug.c:173 +msgid "Supported debug values:" +msgstr "Підтримувані зневаджувальні значення:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "Особливі зневаджувальні значення:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "Вмикає всі неповедінкові зневаджувальні параметри" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Прапорці зневадження Cogl для встановлення" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Прапорці зневадження Cogl для усунення" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Параметри Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Показати параметри Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Трасування Cogl" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "Посилання CoglObject" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "Зневаджувальне підрахування помилок посилань CoglObjects" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "Маршрут нарізування текстур" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "Зневадження створення нарізів текстур" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "Маршрут текстур атласу" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "Керування зневадженням текстур атласу" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "Маршрут суміші рядків" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "Зневаджувальний аналізатор CoglBlendString" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "Маршрут журналу" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "Переглянути всі геометрії, які проходять через журнал" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "Маршрут пакування" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "Показати геометрію, яку запаковано в журнал" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "Маршрут матриці" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "Маршрут усіх маніпуляцій матрицею" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "Маршрут іншого малювання" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "Маршрут деяких інших операції щодо малювання" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "Маршрут відтворення Pango" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "Маршрут відтворення Cogl Pango" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "Маршрут модуля CoglTexturePixmap" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "Маршрут модуля зображення текстур Cogl" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "Візуалізувати" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "Контурні прямокутники" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "Додати прямий контур для всієї прямокутної геометрії" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "Показати каркаси" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "Додати прямі контури для всієї геометрії" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "Корінна причина" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "Вимкнути пакування журналу" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "Вимкнути пакування геометрії в журналі Cogl." + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "Вимкнути вершинні буфери GL" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "Вимкнути об'єкти вершинного буфера OpenGL" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "Вимкнути зображувальні буфери GL" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "Вимкнути об'єкти зображувального буфера OpenGL" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "Вимкнути прямокутного перетворення у програмі " + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "Використати GPU для перетворення прямокутної геометрії" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Знавець з Cogl" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "Дамп зображень атласу" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "Дамп змін текстур атласу для малюнку" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "Вимкнути текстури атласу" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "Вимкнути використання текстур атласу" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "Вимкнути обмін текстур атласу між текстом і зображенням" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "Вимкнути текстури" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "Вимкнути текстури будь-яких примітивів" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "Вимкнути arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "Вимкнути використання програм з фрагментами ARB" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "Вимкнути fixed" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "Вимкнути використання функції fixed для модуля каналу даних" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "Вимкнути GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "Вимкнути використання GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "Вимкнути накладання" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "Вимкнути використання накладання" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "Вимкнути текстури non-power-of-two" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "Вимкнути програмне обрізання" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "Вимкнути спроби Cogl обрізати деякі прямокутники в програмі." + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "Показати джерело" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "Показати породжений код ARBfp/GLSL" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "Маршрут деяких OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "Маршрут деяких вибраних викликів OpenGL" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "Маршрут закадрового підтримування" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "Зневадження закадрового підтримування" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "Вимкнути кеші програм" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "Вимкнути запасні кеші для програм arbfp і glsl" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "Вимкнути оптимізування пікселів для читання" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" +"Вимкнути оптимізування для читання одного пікселя для простих сцен " +"непрозорих прямокутників" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "Маршрут обрізання" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "Записує інформацію про спосіб реалізації обрізання в Cogl" diff --git a/po/vi.gmo b/po/vi.gmo new file mode 100644 index 0000000..0bc86c3 Binary files /dev/null and b/po/vi.gmo differ diff --git a/po/vi.po b/po/vi.po new file mode 100644 index 0000000..68b6227 --- /dev/null +++ b/po/vi.po @@ -0,0 +1,337 @@ +# Vietnamese translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Nguyễn Thái Ngọc Duy , 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: 2012-04-19 12:04+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:173 +msgid "Supported debug values:" +msgstr "" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "Bật cờ tìm lỗi Cogl" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "Tắt cờ tìm lỗi Cogl" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Tuỳ chọn Cogl" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "Hiện tuỳ chọn Cogl" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +msgid "Root Cause" +msgstr "" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "" diff --git a/po/zh_CN.gmo b/po/zh_CN.gmo new file mode 100644 index 0000000..9532ee0 Binary files /dev/null and b/po/zh_CN.gmo differ diff --git a/po/zh_CN.po b/po/zh_CN.po new file mode 100644 index 0000000..2008da3 --- /dev/null +++ b/po/zh_CN.po @@ -0,0 +1,365 @@ +# Chinese (China) translation for cogl. +# Copyright (C) 2011 cogl's COPYRIGHT HOLDER +# This file is distributed under the same license as the cogl package. +# Wylmer Wang , 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-03-20 15:17+0000\n" +"Last-Translator: Wylmer Wang \n" +"Language-Team: Chinese (China) \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:173 +msgid "Supported debug values:" +msgstr "支持的调试值:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "特殊的调试值:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "启用所有非行为调式选项" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "要设置的 Cogl 调试选项" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "要清除的 Cogl 调试选项" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl 选项" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "显示 Cogl 选项" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl 跟踪" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject 引用" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "调试 CoglObjects 的引用计数问题" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "跟踪纹理切片" + +#: cogl/cogl-debug-options.h:33 +#, fuzzy +msgid "debug the creation of texture slices" +msgstr "调试纹理切片的创建" + +#: cogl/cogl-debug-options.h:37 +#, fuzzy +msgid "Trace Atlas Textures" +msgstr "跟踪 Atlas 纹理" + +#: cogl/cogl-debug-options.h:38 +#, fuzzy +msgid "Debug texture atlas management" +msgstr "调试纹理 atlas 管理" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "跟踪混合字符串" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "调试 CoglBlendString 解析" + +#: cogl/cogl-debug-options.h:47 +#, fuzzy +msgid "Trace Journal" +msgstr "跟踪日志" + +#: cogl/cogl-debug-options.h:48 +#, fuzzy +msgid "View all the geometry passing through the journal" +msgstr "查看所有通过日志传递的几何体" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "跟踪批处理" + +#: cogl/cogl-debug-options.h:53 +#, fuzzy +msgid "Show how geometry is being batched in the journal" +msgstr "显示几何体在日志中被分批处理的情况" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "跟踪矩阵" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "跟踪所有矩阵操作" + +#: cogl/cogl-debug-options.h:63 +#, fuzzy +msgid "Trace Misc Drawing" +msgstr "跟踪混杂绘制" + +#: cogl/cogl-debug-options.h:64 +#, fuzzy +msgid "Trace some misc drawing operations" +msgstr "跟踪一些混杂的绘制操作" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "跟踪 Pango 渲染器" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "跟踪 Cogl Pango 渲染器" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "跟踪 CoglTexturePixmap 后端" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "跟踪 Cogl 纹理 pixmap 后端" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "可视化" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "突显矩形" + +#: cogl/cogl-debug-options.h:79 +#, fuzzy +msgid "Add wire outlines for all rectangular geometry" +msgstr "对所有矩形形状添加实线外框" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "显示线框" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "对所有形状添加线框" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +#, fuzzy +msgid "Root Cause" +msgstr "根目标" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "禁用日志批处理" + +#: cogl/cogl-debug-options.h:89 +#, fuzzy +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "在 Cogl 日志中禁用几何体批处理" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "禁用 GL Vertex 缓冲" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "禁用使用 OpenGL 顶点缓存对象" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "禁用 GL 像素缓存" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "禁止使用 OpenGL 像素缓存对象" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "禁用软件矩形变换" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "使用 GPU 来变换矩形" + +#: cogl/cogl-debug-options.h:106 +#, fuzzy +msgid "Cogl Specialist" +msgstr "Cogl 专家" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "转储 Atlas 图像" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "将纹理 Atlas 更改转储为图像文件" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "禁用纹理平滑" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "禁止使用纹理平滑" + +#: cogl/cogl-debug-options.h:118 +#, fuzzy +msgid "Disable sharing the texture atlas between text and images" +msgstr "禁用文档和图形间的纹理 Atlas 共享" + +#: cogl/cogl-debug-options.h:119 +#, 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 "" +"一旦设置,图形字符缓存 Atlas 将总是使用单独的纹理。否则,它将尝试与图像共享 " +"Atlas。" + +#: cogl/cogl-debug-options.h:124 +msgid "Disable texturing" +msgstr "禁用纹理" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "禁止用任何元素使用纹理" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "禁用 arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "禁用 ARB 分割程序" + +#: cogl/cogl-debug-options.h:134 +#, fuzzy +msgid "Disable fixed" +msgstr "禁止固定" + +#: cogl/cogl-debug-options.h:135 +#, fuzzy +msgid "Disable use of the fixed function pipeline backend" +msgstr "禁用固定的函数管道后端" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "禁用 GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "禁止使用 GLSL" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "禁用混合" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "禁止使用混合" + +#: cogl/cogl-debug-options.h:149 +#, fuzzy +msgid "Disable non-power-of-two textures" +msgstr "禁用 non-power-of-two 纹理" + +#: cogl/cogl-debug-options.h:150 +#, fuzzy +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:155 +#, fuzzy +msgid "Disable software clipping" +msgstr "禁用软件剪切" + +#: cogl/cogl-debug-options.h:156 +#, fuzzy +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "在软件中禁止 Cogl 尝试剪切某些矩形。" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "显示源代码" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "显示生成的 ARBfp/GLSL 源代码" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "跟踪某些 OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "跟踪某些选择 OpenGL 的调用" + +#: cogl/cogl-debug-options.h:170 +#, fuzzy +msgid "Trace offscreen support" +msgstr "跟踪幕后支持" + +#: cogl/cogl-debug-options.h:171 +#, fuzzy +msgid "Debug offscreen support" +msgstr "调试幕后支持" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "禁用程序缓存" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "禁用 arbfp 和 glsl 程序的后备缓存" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "禁用读取像素优化" + +#: cogl/cogl-debug-options.h:181 +#, fuzzy +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "禁止对在透明矩形场景中读取单个像素操作的优化" + +#: cogl/cogl-debug-options.h:186 +#, fuzzy +msgid "Trace clipping" +msgstr "跟踪剪切" + +#: cogl/cogl-debug-options.h:187 +#, fuzzy +msgid "Logs information about how Cogl is implementing clipping" +msgstr "记录有关 Cogl 如何实施剪切的信息" diff --git a/po/zh_HK.gmo b/po/zh_HK.gmo new file mode 100644 index 0000000..31295f4 Binary files /dev/null and b/po/zh_HK.gmo differ diff --git a/po/zh_HK.po b/po/zh_HK.po new file mode 100644 index 0000000..5c1cc9f --- /dev/null +++ b/po/zh_HK.po @@ -0,0 +1,340 @@ +# 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-01-30 19:14+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:173 +msgid "Supported debug values:" +msgstr "支援的除錯數值:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "特殊的除錯數值:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "啟用所有非行為性的除錯選項" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "準備設定的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "準備去除的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl 選項" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "顯示 Cogl 選項" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl 追蹤" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject 參照" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects 的除錯參考持續問題" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "追蹤材質切割" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "材質切割建立的除錯" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "追蹤圖集材質" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "除錯材質圖集管理" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "追蹤混合字串" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "除錯 CoglBlendString 解析" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "追蹤日誌" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "檢視所有通過日誌的位置大小" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "追蹤批次" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "顯示日誌中批次的幾何大小如何" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "追蹤矩陣" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "追蹤所有的矩陣操作" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "追蹤雜項繪製" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "追蹤某些繪製操作" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "追蹤 Pango 繪製器" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "追蹤 Cogl Pango 繪製器" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "追蹤 CoglTexturePixmap 後端" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "追蹤 Cogl Pango 材質點陣圖後端" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "視覺化" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "矩形外框" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "為所有的矩形位置大小加入線框" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "顯示線框" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "為所有的位置大小加入線框" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +#, fuzzy +msgid "Root Cause" +msgstr "根窗格" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "停用日誌批次" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "停用 Cogl 日誌中位置大小的批次。" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "停用 GL 頂端緩衝區" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "停用 OpenGL 頂端緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "停用 GL 像素緩衝區" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "停用 OpenGL 像素緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "停用軟件矩形變形" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "使用 GPU 來轉變矩形位置大小" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl 專家" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "傾印圖集影像" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "將材質圖集更改傾印到影像檔案" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "停用材質圖集" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "停用材質圖集的使用" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "停用在文字與影像間分享材質圖集" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "停用材質" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "停用任何原型的材質" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "停用 arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "停用 ARB 片段程式的使用" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "停用修正" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "停用修正函數導管後端的使用" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "停用 GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "停用 GLSL的使用" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "停用混合" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "停用混合的使用" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "停用 non-power-of-two 材質" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "停用軟件剪裁" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "停用 Cogl 在軟件中嘗試剪裁某些矩形。" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "顯示來源" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "顯示產生的 ARBfp/GLSL 原始碼" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "追蹤某些 OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "追蹤某些選取的 OpenGL 呼叫" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "追蹤螢幕外支援" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "除錯螢幕外支援" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "停用程式快取" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "停用 arbfp 和 glsl 程式的後備快取" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "停用讀取像素最佳化" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "追蹤剪裁" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "關於 Cogl 如何實作剪裁的紀錄資訊" diff --git a/po/zh_TW.gmo b/po/zh_TW.gmo new file mode 100644 index 0000000..adcc5a5 Binary files /dev/null and b/po/zh_TW.gmo differ diff --git a/po/zh_TW.po b/po/zh_TW.po new file mode 100644 index 0000000..bda7347 --- /dev/null +++ b/po/zh_TW.po @@ -0,0 +1,340 @@ +# Chinese (Taiwan) 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: 2012-04-19 12:04+0100\n" +"PO-Revision-Date: 2012-01-30 11:31+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:173 +msgid "Supported debug values:" +msgstr "支援的除錯數值:" + +#: cogl/cogl-debug.c:178 +msgid "Special debug values:" +msgstr "特殊的除錯數值:" + +#: cogl/cogl-debug.c:180 cogl/cogl-debug.c:182 +msgid "Enables all non-behavioural debug options" +msgstr "啟用所有非行為性的除錯選項" + +#: cogl/cogl-debug.c:226 +msgid "Cogl debugging flags to set" +msgstr "準備設定的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:228 +msgid "Cogl debugging flags to unset" +msgstr "準備去除的 Cogl 偵錯旗標" + +#: cogl/cogl-debug.c:277 +msgid "Cogl Options" +msgstr "Cogl 選項" + +#: cogl/cogl-debug.c:278 +msgid "Show Cogl options" +msgstr "顯示 Cogl 選項" + +#: cogl/cogl-debug-options.h:25 cogl/cogl-debug-options.h:30 +#: cogl/cogl-debug-options.h:35 cogl/cogl-debug-options.h:40 +#: cogl/cogl-debug-options.h:45 cogl/cogl-debug-options.h:50 +#: cogl/cogl-debug-options.h:55 cogl/cogl-debug-options.h:61 +#: cogl/cogl-debug-options.h:66 cogl/cogl-debug-options.h:71 +#: cogl/cogl-debug-options.h:158 cogl/cogl-debug-options.h:163 +#: cogl/cogl-debug-options.h:168 cogl/cogl-debug-options.h:184 +msgid "Cogl Tracing" +msgstr "Cogl 追蹤" + +#: cogl/cogl-debug-options.h:27 +msgid "CoglObject references" +msgstr "CoglObject 參照" + +#: cogl/cogl-debug-options.h:28 +msgid "Debug ref counting issues for CoglObjects" +msgstr "CoglObjects 的除錯參考持續問題" + +#: cogl/cogl-debug-options.h:32 +msgid "Trace Texture Slicing" +msgstr "追蹤材質切割" + +#: cogl/cogl-debug-options.h:33 +msgid "debug the creation of texture slices" +msgstr "材質切割建立的除錯" + +#: cogl/cogl-debug-options.h:37 +msgid "Trace Atlas Textures" +msgstr "追蹤圖集材質" + +#: cogl/cogl-debug-options.h:38 +msgid "Debug texture atlas management" +msgstr "除錯材質圖集管理" + +#: cogl/cogl-debug-options.h:42 +msgid "Trace Blend Strings" +msgstr "追蹤混合字串" + +#: cogl/cogl-debug-options.h:43 +msgid "Debug CoglBlendString parsing" +msgstr "除錯 CoglBlendString 解析" + +#: cogl/cogl-debug-options.h:47 +msgid "Trace Journal" +msgstr "追蹤日誌" + +#: cogl/cogl-debug-options.h:48 +msgid "View all the geometry passing through the journal" +msgstr "檢視所有通過日誌的位置大小" + +#: cogl/cogl-debug-options.h:52 +msgid "Trace Batching" +msgstr "追蹤批次" + +#: cogl/cogl-debug-options.h:53 +msgid "Show how geometry is being batched in the journal" +msgstr "顯示日誌中批次的幾何大小如何" + +#: cogl/cogl-debug-options.h:57 +msgid "Trace matrices" +msgstr "追蹤矩陣" + +#: cogl/cogl-debug-options.h:58 +msgid "Trace all matrix manipulation" +msgstr "追蹤所有的矩陣操作" + +#: cogl/cogl-debug-options.h:63 +msgid "Trace Misc Drawing" +msgstr "追蹤雜項繪製" + +#: cogl/cogl-debug-options.h:64 +msgid "Trace some misc drawing operations" +msgstr "追蹤某些繪製操作" + +#: cogl/cogl-debug-options.h:68 +msgid "Trace Pango Renderer" +msgstr "追蹤 Pango 繪製器" + +#: cogl/cogl-debug-options.h:69 +msgid "Trace the Cogl Pango renderer" +msgstr "追蹤 Cogl Pango 繪製器" + +#: cogl/cogl-debug-options.h:73 +msgid "Trace CoglTexturePixmap backend" +msgstr "追蹤 CoglTexturePixmap 後端" + +#: cogl/cogl-debug-options.h:74 +msgid "Trace the Cogl texture pixmap backend" +msgstr "追蹤 Cogl Pango 材質點陣圖後端" + +#: cogl/cogl-debug-options.h:76 cogl/cogl-debug-options.h:81 +msgid "Visualize" +msgstr "視覺化" + +#: cogl/cogl-debug-options.h:78 +msgid "Outline rectangles" +msgstr "矩形外框" + +#: cogl/cogl-debug-options.h:79 +msgid "Add wire outlines for all rectangular geometry" +msgstr "為所有的矩形位置大小加入線框" + +#: cogl/cogl-debug-options.h:83 +msgid "Show wireframes" +msgstr "顯示線框" + +#: cogl/cogl-debug-options.h:84 +msgid "Add wire outlines for all geometry" +msgstr "為所有的位置大小加入線框" + +#: cogl/cogl-debug-options.h:86 cogl/cogl-debug-options.h:91 +#: cogl/cogl-debug-options.h:96 cogl/cogl-debug-options.h:101 +#: cogl/cogl-debug-options.h:111 cogl/cogl-debug-options.h:116 +#: cogl/cogl-debug-options.h:122 cogl/cogl-debug-options.h:127 +#: cogl/cogl-debug-options.h:132 cogl/cogl-debug-options.h:137 +#: cogl/cogl-debug-options.h:142 cogl/cogl-debug-options.h:147 +#: cogl/cogl-debug-options.h:153 cogl/cogl-debug-options.h:173 +#: cogl/cogl-debug-options.h:178 +#, fuzzy +msgid "Root Cause" +msgstr "根窗格" + +#: cogl/cogl-debug-options.h:88 +msgid "Disable Journal batching" +msgstr "停用日誌批次" + +#: cogl/cogl-debug-options.h:89 +msgid "Disable batching of geometry in the Cogl Journal." +msgstr "停用 Cogl 日誌中位置大小的批次。" + +#: cogl/cogl-debug-options.h:93 +msgid "Disable GL Vertex Buffers" +msgstr "停用 GL 頂端緩衝區" + +#: cogl/cogl-debug-options.h:94 +msgid "Disable use of OpenGL vertex buffer objects" +msgstr "停用 OpenGL 頂端緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:98 +msgid "Disable GL Pixel Buffers" +msgstr "停用 GL 像素緩衝區" + +#: cogl/cogl-debug-options.h:99 +msgid "Disable use of OpenGL pixel buffer objects" +msgstr "停用 OpenGL 像素緩衝區物件的使用" + +#: cogl/cogl-debug-options.h:103 +msgid "Disable software rect transform" +msgstr "停用軟體矩形變形" + +#: cogl/cogl-debug-options.h:104 +msgid "Use the GPU to transform rectangular geometry" +msgstr "使用 GPU 來轉變矩形位置大小" + +#: cogl/cogl-debug-options.h:106 +msgid "Cogl Specialist" +msgstr "Cogl 專家" + +#: cogl/cogl-debug-options.h:108 +msgid "Dump atlas images" +msgstr "傾印圖集影像" + +#: cogl/cogl-debug-options.h:109 +msgid "Dump texture atlas changes to an image file" +msgstr "將材質圖集變更傾印到影像檔案" + +#: cogl/cogl-debug-options.h:113 +msgid "Disable texture atlasing" +msgstr "停用材質圖集" + +#: cogl/cogl-debug-options.h:114 +msgid "Disable use of texture atlasing" +msgstr "停用材質圖集的使用" + +#: cogl/cogl-debug-options.h:118 +msgid "Disable sharing the texture atlas between text and images" +msgstr "停用在文字與影像間分享材質圖集" + +#: cogl/cogl-debug-options.h:119 +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:124 +msgid "Disable texturing" +msgstr "停用材質" + +#: cogl/cogl-debug-options.h:125 +msgid "Disable texturing any primitives" +msgstr "停用任何原型的材質" + +#: cogl/cogl-debug-options.h:129 +msgid "Disable arbfp" +msgstr "停用 arbfp" + +#: cogl/cogl-debug-options.h:130 +msgid "Disable use of ARB fragment programs" +msgstr "停用 ARB 片段程式的使用" + +#: cogl/cogl-debug-options.h:134 +msgid "Disable fixed" +msgstr "停用修正" + +#: cogl/cogl-debug-options.h:135 +msgid "Disable use of the fixed function pipeline backend" +msgstr "停用修正函式導管後端的使用" + +#: cogl/cogl-debug-options.h:139 +msgid "Disable GLSL" +msgstr "停用 GLSL" + +#: cogl/cogl-debug-options.h:140 +msgid "Disable use of GLSL" +msgstr "停用 GLSL的使用" + +#: cogl/cogl-debug-options.h:144 +msgid "Disable blending" +msgstr "停用混合" + +#: cogl/cogl-debug-options.h:145 +msgid "Disable use of blending" +msgstr "停用混合的使用" + +#: cogl/cogl-debug-options.h:149 +msgid "Disable non-power-of-two textures" +msgstr "停用 non-power-of-two 材質" + +#: cogl/cogl-debug-options.h:150 +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:155 +msgid "Disable software clipping" +msgstr "停用軟體剪裁" + +#: cogl/cogl-debug-options.h:156 +msgid "Disables Cogl's attempts to clip some rectangles in software." +msgstr "停用 Cogl 在軟體中嘗試剪裁某些矩形。" + +#: cogl/cogl-debug-options.h:160 +msgid "Show source" +msgstr "顯示來源" + +#: cogl/cogl-debug-options.h:161 +msgid "Show generated ARBfp/GLSL source code" +msgstr "顯示產生的 ARBfp/GLSL 原始碼" + +#: cogl/cogl-debug-options.h:165 +msgid "Trace some OpenGL" +msgstr "追蹤某些 OpenGL" + +#: cogl/cogl-debug-options.h:166 +msgid "Traces some select OpenGL calls" +msgstr "追蹤某些選取的 OpenGL 呼叫" + +#: cogl/cogl-debug-options.h:170 +msgid "Trace offscreen support" +msgstr "追蹤螢幕外支援" + +#: cogl/cogl-debug-options.h:171 +msgid "Debug offscreen support" +msgstr "除錯螢幕外支援" + +#: cogl/cogl-debug-options.h:175 +msgid "Disable program caches" +msgstr "停用程式快取" + +#: cogl/cogl-debug-options.h:176 +msgid "Disable fallback caches for arbfp and glsl programs" +msgstr "停用 arbfp 和 glsl 程式的後備快取" + +#: cogl/cogl-debug-options.h:180 +msgid "Disable read pixel optimization" +msgstr "停用讀取像素最佳化" + +#: cogl/cogl-debug-options.h:181 +msgid "" +"Disable optimization for reading 1px for simple scenes of opaque rectangles" +msgstr "" + +#: cogl/cogl-debug-options.h:186 +msgid "Trace clipping" +msgstr "追蹤剪裁" + +#: cogl/cogl-debug-options.h:187 +msgid "Logs information about how Cogl is implementing clipping" +msgstr "關於 Cogl 如何實作剪裁的紀錄資訊" diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..0eea904 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,13 @@ +SUBDIRS = conform data + +DIST_SUBDIRS = conform data + +EXTRA_DIST = README + +test conform: + ( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? + +.PHONY: test conform + +# run make test as part of make check +check-local: test diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..834462f --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,677 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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 data +DIST_SUBDIRS = conform data +EXTRA_DIST = README +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): + +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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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 +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am check-local clean clean-generic \ + clean-libtool ctags ctags-recursive 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-recursive uninstall uninstall-am + + +test conform: + ( 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/conform/Makefile.am b/tests/conform/Makefile.am new file mode 100644 index 0000000..e6ffc7b --- /dev/null +++ b/tests/conform/Makefile.am @@ -0,0 +1,172 @@ +include $(top_srcdir)/build/autotools/Makefile.am.silent + +NULL = + +noinst_PROGRAMS = test-conformance + +common_sources = \ + test-utils.h \ + test-utils.c \ + 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-premult.c \ + test-readpixels.c \ + test-texture-get-set-data.c \ + test-texture-mipmaps.c \ + test-texture-pixmap-x11.c \ + test-texture-rectangle.c \ + test-atlas-migration.c \ + test-vertex-buffer-contiguous.c \ + test-vertex-buffer-interleved.c \ + test-vertex-buffer-mutability.c \ + $(NULL) + +test_sources = \ + test-bitmask.c \ + test-blend-strings.c \ + test-depth-test.c \ + test-color-mask.c \ + test-backface-culling.c \ + test-just-vertex-shader.c \ + test-path.c \ + test-pipeline-user-matrix.c \ + test-pipeline-uniforms.c \ + test-pixel-buffer.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-sprite.c \ + $(NULL) + +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 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 "$(abs_builddir)/test-launcher.sh '$$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 + +# 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 +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_builddir)/cogl + +test_conformance_CPPFLAGS = \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \ + -DCLUTTER_COMPILATION + +test_conformance_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +test_conformance_LDADD = $(COGL_DEP_LIBS) $(top_builddir)/cogl/libcogl.la +test_conformance_LDFLAGS = -export-dynamic + +test: wrappers + @$(top_srcdir)/tests/conform/run-tests.sh $(abs_builddir)/config.env + +# XXX: we could prevent the conformance test suite from running +# by simply defining this variable conditionally +TEST_PROGS = test-conformance + +.PHONY: test + +EXTRA_DIST = test-launcher.sh.in run-tests.sh +DISTCLEANFILES = test-launcher.sh .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 diff --git a/tests/conform/Makefile.in b/tests/conform/Makefile.in new file mode 100644 index 0000000..647a9db --- /dev/null +++ b/tests/conform/Makefile.in @@ -0,0 +1,1220 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.env.in $(srcdir)/test-launcher.sh.in \ + $(top_srcdir)/build/autotools/Makefile.am.silent +noinst_PROGRAMS = test-conformance$(EXEEXT) +subdir = tests/conform +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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 test-launcher.sh +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am__objects_1 = +am__objects_2 = test_conformance-test-utils.$(OBJEXT) \ + test_conformance-test-conform-main.$(OBJEXT) $(am__objects_1) +am__objects_3 = test_conformance-test-bitmask.$(OBJEXT) \ + test_conformance-test-blend-strings.$(OBJEXT) \ + test_conformance-test-depth-test.$(OBJEXT) \ + test_conformance-test-color-mask.$(OBJEXT) \ + test_conformance-test-backface-culling.$(OBJEXT) \ + test_conformance-test-just-vertex-shader.$(OBJEXT) \ + test_conformance-test-path.$(OBJEXT) \ + test_conformance-test-pipeline-user-matrix.$(OBJEXT) \ + test_conformance-test-pipeline-uniforms.$(OBJEXT) \ + test_conformance-test-pixel-buffer.$(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-sprite.$(OBJEXT) $(am__objects_1) +am_test_conformance_OBJECTS = $(am__objects_2) $(am__objects_3) +test_conformance_OBJECTS = $(am_test_conformance_OBJECTS) +am__DEPENDENCIES_1 = +test_conformance_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/cogl/libcogl.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +test_conformance_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_conformance_CFLAGS) $(CFLAGS) \ + $(test_conformance_LDFLAGS) $(LDFLAGS) -o $@ +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_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +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_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(test_conformance_SOURCES) +DIST_SOURCES = $(test_conformance_SOURCES) +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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-utils.h \ + test-utils.c \ + 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-premult.c \ + test-readpixels.c \ + test-texture-get-set-data.c \ + test-texture-mipmaps.c \ + test-texture-pixmap-x11.c \ + test-texture-rectangle.c \ + test-atlas-migration.c \ + test-vertex-buffer-contiguous.c \ + test-vertex-buffer-interleved.c \ + test-vertex-buffer-mutability.c \ + $(NULL) + +test_sources = \ + test-bitmask.c \ + test-blend-strings.c \ + test-depth-test.c \ + test-color-mask.c \ + test-backface-culling.c \ + test-just-vertex-shader.c \ + test-path.c \ + test-pipeline-user-matrix.c \ + test-pipeline-uniforms.c \ + test-pixel-buffer.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-sprite.c \ + $(NULL) + +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 + +# 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 +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_builddir)/cogl + +test_conformance_CPPFLAGS = \ + -DCOGL_ENABLE_EXPERIMENTAL_API \ + -DCOGL_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \ + -DCLUTTER_COMPILATION + +test_conformance_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) +test_conformance_LDADD = $(COGL_DEP_LIBS) $(top_builddir)/cogl/libcogl.la +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 +EXTRA_DIST = test-launcher.sh.in run-tests.sh + +# Let the VS9/VS10 Project files be cleared out before they are re-expanded... +DISTCLEANFILES = test-launcher.sh .gitignore \ + ../../build/win32/vs9/test-conformance-cogl.vcproj \ + ../../build/win32/vs10/test-conformance-cogl.vcxproj \ + ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters +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_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)/$@ +test-launcher.sh: $(top_builddir)/config.status $(srcdir)/test-launcher.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +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) + @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-backface-culling.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_conformance-test-bitmask.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-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-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-just-vertex-shader.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.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.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-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-utils.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-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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +test_conformance-test-utils.o: test-utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-utils.o -MD -MP -MF $(DEPDIR)/test_conformance-test-utils.Tpo -c -o test_conformance-test-utils.o `test -f 'test-utils.c' || echo '$(srcdir)/'`test-utils.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-utils.Tpo $(DEPDIR)/test_conformance-test-utils.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-utils.c' object='test_conformance-test-utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-utils.o `test -f 'test-utils.c' || echo '$(srcdir)/'`test-utils.c + +test_conformance-test-utils.obj: test-utils.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-utils.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-utils.Tpo -c -o test_conformance-test-utils.obj `if test -f 'test-utils.c'; then $(CYGPATH_W) 'test-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-utils.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-utils.Tpo $(DEPDIR)/test_conformance-test-utils.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-utils.c' object='test_conformance-test-utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-utils.obj `if test -f 'test-utils.c'; then $(CYGPATH_W) 'test-utils.c'; else $(CYGPATH_W) '$(srcdir)/test-utils.c'; fi` + +test_conformance-test-conform-main.o: test-conform-main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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-bitmask.o: test-bitmask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-bitmask.o -MD -MP -MF $(DEPDIR)/test_conformance-test-bitmask.Tpo -c -o test_conformance-test-bitmask.o `test -f 'test-bitmask.c' || echo '$(srcdir)/'`test-bitmask.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-bitmask.Tpo $(DEPDIR)/test_conformance-test-bitmask.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-bitmask.c' object='test_conformance-test-bitmask.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-bitmask.o `test -f 'test-bitmask.c' || echo '$(srcdir)/'`test-bitmask.c + +test_conformance-test-bitmask.obj: test-bitmask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -MT test_conformance-test-bitmask.obj -MD -MP -MF $(DEPDIR)/test_conformance-test-bitmask.Tpo -c -o test_conformance-test-bitmask.obj `if test -f 'test-bitmask.c'; then $(CYGPATH_W) 'test-bitmask.c'; else $(CYGPATH_W) '$(srcdir)/test-bitmask.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_conformance-test-bitmask.Tpo $(DEPDIR)/test_conformance-test-bitmask.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-bitmask.c' object='test_conformance-test-bitmask.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_CPPFLAGS) $(CPPFLAGS) $(test_conformance_CFLAGS) $(CFLAGS) -c -o test_conformance-test-bitmask.obj `if test -f 'test-bitmask.c'; then $(CYGPATH_W) 'test-bitmask.c'; else $(CYGPATH_W) '$(srcdir)/test-bitmask.c'; fi` + +test_conformance-test-blend-strings.o: test-blend-strings.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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-depth-test.o: test-depth-test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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-mask.o: test-color-mask.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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-path.o: test-path.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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-pipeline-user-matrix.o: test-pipeline-user-matrix.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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-snippets.o: test-snippets.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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-sprite.o: test-point-sprite.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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) $(test_conformance_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 +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_conformance_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` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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) +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags 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-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 uninstall uninstall-am + + +# 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 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 "$(abs_builddir)/test-launcher.sh '$$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/conform/run-tests.sh $(abs_builddir)/config.env + +.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 + +# 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/config.env.in b/tests/conform/config.env.in new file mode 100644 index 0000000..d377756 --- /dev/null +++ b/tests/conform/config.env.in @@ -0,0 +1,3 @@ +HAVE_GL=@HAVE_GL@ +HAVE_GLES1=@HAVE_GLES1@ +HAVE_GLES2=@HAVE_GLES2@ diff --git a/tests/conform/run-tests.sh b/tests/conform/run-tests.sh new file mode 100755 index 0000000..fc476a8 --- /dev/null +++ b/tests/conform/run-tests.sh @@ -0,0 +1,132 @@ +#!/bin/bash + +. $1 + +set +m + +trap "" ERR +trap "" SIGABRT +trap "" SIGFPE +trap "" SIGSEGV + +EXIT=0 +WARNING="WARNING: Missing required feature"; + +if test -f ./test-conformance; then + TEST_CONFORMANCE=./test-conformance +elif test -f ./test-conformance.exe; then + TEST_CONFORMANCE=./test-conformance.exe +fi + +echo "Key:" +echo "ok = Test passed" +echo "FAIL = Unexpected failure" +echo "fail = 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 "fail";; + # Special value we use to indicate that the test passed + # but we weren't expecting it to pass‽ + 400) + echo -n 'PASS!';; + + 0) + echo -n "ok";; + + *) + echo -n "FAIL";; + esac +} + +run_test() +{ + $($TEST_CONFORMANCE $1 &>.log) + TMP=$? + var_name=$2_result + eval $var_name=$TMP + if grep -q "$WARNING" .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" + printf "$GL_FORMAT" "GL+FF" "GL+ARBFP" "GL+GLSL" "GL-NPT" +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 + 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`" + 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/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c new file mode 100644 index 0000000..fe1eda5 --- /dev/null +++ b/tests/conform/test-backface-culling.c @@ -0,0 +1,308 @@ +#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, gboolean 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 (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++) + { + gboolean 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) + { + gboolean 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, 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 (ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, state->offscreen_tex); + cogl_framebuffer_draw_rectangle (fb, + pipeline, + 0, TEXTURE_RENDER_SIZE * 16, + state->width, + state->height + TEXTURE_RENDER_SIZE * 16); + cogl_object_unref (pipeline); + + validate_result (fb, 0); + validate_result (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 = cogl_texture_new_from_data (TEXTURE_SIZE, + TEXTURE_SIZE, + COGL_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGBA_8888, + COGL_PIXEL_FORMAT_ANY, + 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 (fb); + state.height = cogl_framebuffer_get_height (fb); + + state.offscreen = NULL; + + state.texture = make_texture (); + + tex = cogl_texture_new_with_size (state.width, state.height, + COGL_TEXTURE_NO_SLICING, + COGL_PIXEL_FORMAT_ANY); /* internal fmt */ + state.offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_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-bitmask.c b/tests/conform/test-bitmask.c new file mode 100644 index 0000000..3e5e173 --- /dev/null +++ b/tests/conform/test-bitmask.c @@ -0,0 +1,185 @@ +#include + +#include +#include + +#include "test-utils.h" + +/* This is testing CoglBitmask which is an internal data structure + within Cogl. Cogl doesn't export the symbols for this data type so + we just directly include the source instead */ + +#include +#include +#define _COGL_IN_TEST_BITMASK +#include + +typedef struct +{ + int n_bits; + int *bits; +} CheckData; + +static gboolean +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)); + } +} + +void +test_bitmask (void) +{ + 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)); + + 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..4fcf85f --- /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, + guint32 src_color, + guint32 dst_color, + const char *blend_string, + guint32 blend_constant, + guint32 expected_result) +{ + /* src color */ + guint8 Sr = MASK_RED (src_color); + guint8 Sg = MASK_GREEN (src_color); + guint8 Sb = MASK_BLUE (src_color); + guint8 Sa = MASK_ALPHA (src_color); + /* dest color */ + guint8 Dr = MASK_RED (dst_color); + guint8 Dg = MASK_GREEN (dst_color); + guint8 Db = MASK_BLUE (dst_color); + guint8 Da = MASK_ALPHA (dst_color); + /* blend constant - when applicable */ + guint8 Br = MASK_RED (blend_constant); + guint8 Bg = MASK_GREEN (blend_constant); + guint8 Bb = MASK_BLUE (blend_constant); + guint8 Ba = MASK_ALPHA (blend_constant); + CoglColor blend_const_color; + + CoglHandle material; + CoglPipeline *pipeline; + gboolean status; + GError *error = NULL; + int y_off; + int x_off; + + /* First write out the destination color without any blending... */ + pipeline = cogl_pipeline_new (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 (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 (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 (fb, x_off, y_off, expected_result); +} + +static CoglTexture * +make_texture (guint32 color) +{ + guchar *tex_data, *p; + guint8 r = MASK_RED (color); + guint8 g = MASK_GREEN (color); + guint8 b = MASK_BLUE (color); + guint8 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 don't use COGL_PIXEL_FORMAT_ANY for the internal format here + * since we don't want to allow Cogl to premultiply our data. */ + tex = cogl_texture_new_from_data (QUAD_WIDTH, + QUAD_WIDTH, + COGL_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGBA_8888, + COGL_PIXEL_FORMAT_RGBA_8888, + QUAD_WIDTH * 4, + tex_data); + + g_free (tex_data); + + return tex; +} + +static void +test_tex_combine (TestState *state, + int x, + int y, + guint32 tex0_color, + guint32 tex1_color, + guint32 combine_constant, + const char *combine_string, + guint32 expected_result) +{ + CoglTexture *tex0, *tex1; + + /* combine constant - when applicable */ + guint8 Cr = MASK_RED (combine_constant); + guint8 Cg = MASK_GREEN (combine_constant); + guint8 Cb = MASK_BLUE (combine_constant); + guint8 Ca = MASK_ALPHA (combine_constant); + CoglColor combine_const_color; + + CoglHandle material; + gboolean status; + GError *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 (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 (fb, 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (fb), + -1, + 100); + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (fb); + paint (&state); + cogl_pop_framebuffer (); + + 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..1e22cbc --- /dev/null +++ b/tests/conform/test-color-mask.c @@ -0,0 +1,111 @@ +#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 (ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, state->tex[i]); + cogl_framebuffer_draw_rectangle (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++) + { + guint8 expected_colors[NUM_FBOS][4] = + { { 0xff, 0x00, 0x00, 0xff }, + { 0x00, 0xff, 0x00, 0xff }, + { 0x00, 0x00, 0xff, 0xff } }; + + test_utils_check_pixel_rgb (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 (fb); + state.height = cogl_framebuffer_get_height (fb); + + for (i = 0; i < NUM_FBOS; i++) + { + state.tex[i] = cogl_texture_new_with_size (128, 128, + COGL_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGB_888); + + + state.fbo[i] = COGL_FRAMEBUFFER ( + cogl_offscreen_new_to_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 (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..ed5a652 --- /dev/null +++ b/tests/conform/test-conform-main.c @@ -0,0 +1,103 @@ +#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) G_STMT_START { \ + extern void FUNC (void); \ + if (strcmp (#FUNC, argv[1]) == 0) \ + { \ + test_utils_init (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); + ADD_TEST (test_blend_strings, 0); + UNPORTED_TEST (test_premult); + UNPORTED_TEST (test_readpixels); + ADD_TEST (test_path, 0); + ADD_TEST (test_depth_test, 0); + ADD_TEST (test_color_mask, 0); + ADD_TEST (test_backface_culling, TEST_REQUIREMENT_NPOT); + + ADD_TEST (test_sparse_pipeline, 0); + + UNPORTED_TEST (test_npot_texture); + UNPORTED_TEST (test_multitexture); + UNPORTED_TEST (test_texture_mipmaps); + ADD_TEST (test_sub_texture, 0); + ADD_TEST (test_pixel_buffer, 0); + UNPORTED_TEST (test_texture_rectangle); + ADD_TEST (test_texture_3d, 0); + ADD_TEST (test_wrap_modes, 0); + UNPORTED_TEST (test_texture_pixmap_x11); + UNPORTED_TEST (test_texture_get_set_data); + UNPORTED_TEST (test_atlas_migration); + ADD_TEST (test_read_texture_formats, 0); + ADD_TEST (test_write_texture_formats, 0); + + UNPORTED_TEST (test_vertex_buffer_contiguous); + UNPORTED_TEST (test_vertex_buffer_interleved); + UNPORTED_TEST (test_vertex_buffer_mutability); + + ADD_TEST (test_primitive, 0); + + ADD_TEST (test_just_vertex_shader, 0); + ADD_TEST (test_pipeline_uniforms, 0); + ADD_TEST (test_snippets, 0); + ADD_TEST (test_custom_attributes, 0); + + ADD_TEST (test_bitmask, 0); + + ADD_TEST (test_offscreen, 0); + + ADD_TEST (test_point_size, 0); + ADD_TEST (test_point_sprite, + TEST_KNOWN_FAILURE | TEST_REQUIREMENT_POINT_SPRITE); + + UNPORTED_TEST (test_viewport); + + g_printerr ("Unknown test name \"%s\"\n", argv[1]); + + return 1; +} diff --git a/tests/conform/test-custom-attributes.c b/tests/conform/test-custom-attributes.c new file mode 100644 index 0000000..6af4fa2 --- /dev/null +++ b/tests/conform/test-custom-attributes.c @@ -0,0 +1,302 @@ +#include + +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + CoglPipeline *pipeline; +} TestState; + +typedef struct +{ + gint16 x, y; + float r, g, b, a; +} FloatVert; + +typedef struct +{ + gint16 x, y; + guint8 r, g, b, a; +} ByteVert; + +typedef struct +{ + gint16 x, y; +} ShortVert; + +static void +test_float_verts (TestState *state, int offset_x, int offset_y) +{ + CoglAttribute *attributes[2]; + CoglAttributeBuffer *buffer; + + 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 (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 (fb); + cogl_framebuffer_translate (fb, offset_x, offset_y, 0.0f); + + cogl_framebuffer_draw_attributes (fb, + state->pipeline, + COGL_VERTICES_MODE_TRIANGLES, + 0, /* first_vertex */ + 6, /* n_vertices */ + attributes, + 2 /* n_attributes */); + + cogl_framebuffer_pop_matrix (fb); + + cogl_object_unref (attributes[1]); + cogl_object_unref (attributes[0]); + cogl_object_unref (buffer); + + test_utils_check_pixel (fb, offset_x + 5, offset_y + 5, 0xff0000ff); + test_utils_check_pixel (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; + + 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 (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 (fb); + cogl_framebuffer_translate (fb, offset_x, offset_y, 0.0f); + + cogl_framebuffer_draw_attributes (fb, + state->pipeline, + COGL_VERTICES_MODE_TRIANGLES, + 0, /* first_vertex */ + 6, /* n_vertices */ + attributes, + 2 /* n_attributes */); + + cogl_object_unref (attributes[1]); + + /* Test again with unnormalized attributes */ + unnorm_buffer = cogl_attribute_buffer_new (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 (fb, 20, 0, 0); + + cogl_framebuffer_draw_attributes (fb, + state->pipeline, + COGL_VERTICES_MODE_TRIANGLES, + 0, /* first_vertex */ + 3, /* n_vertices */ + attributes, + 2 /* n_attributes */); + + cogl_framebuffer_pop_matrix (fb); + + cogl_object_unref (attributes[0]); + cogl_object_unref (attributes[1]); + cogl_object_unref (buffer); + cogl_object_unref (unnorm_buffer); + + test_utils_check_pixel (fb, offset_x + 5, offset_y + 5, 0xff0000ff); + test_utils_check_pixel (fb, offset_x + 15, offset_y + 5, 0x00ff00ff); + test_utils_check_pixel (fb, offset_x + 25, offset_y + 5, 0x0000ffff); +} + +static void +test_short_verts (TestState *state, int offset_x, int offset_y) +{ + CoglAttribute *attributes[1]; + CoglAttributeBuffer *buffer; + CoglPipeline *pipeline, *pipeline2; + CoglSnippet *snippet; + + static const ShortVert short_verts[] = + { + { -10, -10 }, + { -1, -10 }, + { -5, -1 } + }; + + pipeline = cogl_pipeline_new (ctx); + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_TRANSFORM, + "attribute vec2 pos;", + NULL); + cogl_snippet_set_replace (snippet, + "cogl_position_out = " + "cogl_modelview_projection_matrix * " + "vec4 (pos, 0.0, 1.0);"); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_object_unref (snippet); + + cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + + buffer = cogl_attribute_buffer_new (ctx, + sizeof (short_verts), short_verts); + attributes[0] = cogl_attribute_new (buffer, + "pos", + sizeof (ShortVert), + G_STRUCT_OFFSET (ShortVert, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_SHORT); + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, + offset_x + 10.0f, + offset_y + 10.0f, + 0.0f); + + cogl_framebuffer_draw_attributes (fb, + pipeline, + COGL_VERTICES_MODE_TRIANGLES, + 0, /* first_vertex */ + 3, /* n_vertices */ + attributes, + 1 /* n_attributes */); + + cogl_framebuffer_pop_matrix (fb); + + cogl_object_unref (attributes[0]); + + /* Test again treating the attribute as unsigned */ + attributes[0] = cogl_attribute_new (buffer, + "pos", + sizeof (ShortVert), + G_STRUCT_OFFSET (ShortVert, x), + 2, /* n_components */ + COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT); + + pipeline2 = cogl_pipeline_copy (pipeline); + cogl_pipeline_set_color4ub (pipeline2, 0, 255, 0, 255); + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, + offset_x + 10.0f - 65525.0f, + offset_y - 65525, + 0.0f); + + cogl_framebuffer_draw_attributes (fb, + pipeline2, + COGL_VERTICES_MODE_TRIANGLES, + 0, /* first_vertex */ + 3, /* n_vertices */ + attributes, + 1 /* n_attributes */); + + cogl_framebuffer_pop_matrix (fb); + + cogl_object_unref (attributes[0]); + + cogl_object_unref (pipeline2); + cogl_object_unref (pipeline); + cogl_object_unref (buffer); + + test_utils_check_pixel (fb, offset_x + 5, offset_y + 5, 0xff0000ff); + test_utils_check_pixel (fb, offset_x + 15, offset_y + 5, 0x00ff00ff); +} + +static void +paint (TestState *state) +{ + cogl_framebuffer_clear4f (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) +{ + /* If shaders aren't supported then we can't run the test */ + if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL)) + { + CoglSnippet *snippet; + TestState state; + + cogl_framebuffer_orthographic (fb, + 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (fb), + -1, + 100); + + state.pipeline = cogl_pipeline_new (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"); + } + else if (cogl_test_verbose ()) + g_print ("Skipping\n"); +} diff --git a/tests/conform/test-depth-test.c b/tests/conform/test-depth-test.c new file mode 100644 index 0000000..76891db --- /dev/null +++ b/tests/conform/test-depth-test.c @@ -0,0 +1,274 @@ +#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 +{ + guint32 color; + float depth; + gboolean test_enable; + CoglDepthTestFunction test_function; + gboolean write_enable; + float range_near; + float range_far; +} TestDepthState; + +static gboolean +draw_rectangle (TestState *state, + int x, + int y, + TestDepthState *rect_state, + gboolean legacy_mode) +{ + guint8 Cr = MASK_RED (rect_state->color); + guint8 Cg = MASK_GREEN (rect_state->color); + guint8 Cb = MASK_BLUE (rect_state->color); + guint8 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 (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_push_matrix (fb); + cogl_framebuffer_translate (fb, 0, 0, rect_state->depth); + cogl_framebuffer_draw_rectangle (fb, + pipeline, + x * QUAD_WIDTH, + y * QUAD_WIDTH, + x * QUAD_WIDTH + QUAD_WIDTH, + y * QUAD_WIDTH + QUAD_WIDTH); + cogl_framebuffer_pop_matrix (fb); + } + else + { + cogl_push_framebuffer (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, + gboolean legacy_mode, + guint32 expected_result) +{ + gboolean 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 (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 */ + 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 */ + 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 */ + 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 */ + } + + /* 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 */ + 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 */ + 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 */ + 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 */ + 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 (fb, 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (fb), + -1, + 100); + + paint (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-just-vertex-shader.c b/tests/conform/test-just-vertex-shader.c new file mode 100644 index 0000000..2e05480 --- /dev/null +++ b/tests/conform/test-just-vertex-shader.c @@ -0,0 +1,210 @@ +#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 guint8 data[4] = { 0x00, 0xff, 0x00, 0xff }; + + return cogl_texture_new_from_data (1, 1, /* size */ + COGL_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGB_888, + COGL_PIXEL_FORMAT_ANY, + 4, /* rowstride */ + data); +} + +static void +paint_legacy (TestState *state) +{ + CoglHandle material = cogl_material_new (); + CoglTexture *tex; + CoglColor color; + GError *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 (ctx); + CoglTexture *tex; + CoglColor color; + GError *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 (fb, + 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (fb), + -1, + 100); + + /* If shaders aren't supported then we can't run the test */ + if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL)) + { + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (fb); + + paint_legacy (&state); + validate_result (fb); + + paint (&state); + validate_result (fb); + + cogl_pop_framebuffer (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); + } + else if (cogl_test_verbose ()) + g_print ("Skipping\n"); +} + diff --git a/tests/conform/test-launcher.sh.in b/tests/conform/test-launcher.sh.in new file mode 100755 index 0000000..1c29003 --- /dev/null +++ b/tests/conform/test-launcher.sh.in @@ -0,0 +1,33 @@ +#!/bin/sh + +UNIT_TEST=$1 +shift + +test -z ${UNIT_TEST} && { + echo "Usage: $0 UNIT_TEST" + exit 1 +} + +UNIT_TEST=`echo $UNIT_TEST|sed 's/-/_/g'` + +echo "Running: ./test-conformance ${UNIT_TEST} $@" +echo "" +if test -f @abs_builddir@/test-conformance; then + TEST_CONFORMANCE=@abs_builddir@/test-conformance +elif test -f @abs_builddir@/test-conformance.exe; then + TEST_CONFORMANCE=@abs_builddir@/test-conformance.exe +fi +COGL_TEST_VERBOSE=1 $TEST_CONFORMANCE ${UNIT_TEST} "$@" +exit_val=$? + +echo "" +echo "NOTE: For debugging purposes, you can run this single test as follows:" +echo "$ libtool --mode=execute \\" +echo " gdb --eval-command=\"b ${UNIT_TEST}\" \\" +echo " --args ./test-conformance ${UNIT_TEST}" +echo "or:" +echo "$ env G_SLICE=always-malloc \\" +echo " libtool --mode=execute \\" +echo " valgrind ./test-conformance ${UNIT_TEST}" + +exit $exit_val diff --git a/tests/conform/test-offscreen.c b/tests/conform/test-offscreen.c new file mode 100644 index 0000000..0683a8a --- /dev/null +++ b/tests/conform/test-offscreen.c @@ -0,0 +1,201 @@ +#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, + guint32 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 (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 (ctx, + state->fb_width, + state->fb_height, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + NULL); + tex = COGL_TEXTURE (tex_2d); + + offscreen = cogl_offscreen_new_to_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 (COGL_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 (ctx, + 16, 16, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + NULL); + tex = COGL_TEXTURE (tex_2d); + + offscreen = cogl_offscreen_new_to_texture (tex); + + cogl_push_framebuffer (COGL_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 (COGL_FRAMEBUFFER (offscreen), + 1, 1, 15, 15, 0xff0000ff); + else if (i == 1) + { + guint8 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 (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 (fb); + state.fb_height = cogl_framebuffer_get_height (fb); + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (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.c b/tests/conform/test-path.c new file mode 100644 index 0000000..a7a6f3c --- /dev/null +++ b/tests/conform/test-path.c @@ -0,0 +1,212 @@ +#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 (int x, int y) +{ + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, x * BLOCK_SIZE, y * BLOCK_SIZE, 0.0f); + cogl_path_fill (); + cogl_framebuffer_pop_matrix (fb); +} + +static void +check_block (int block_x, int block_y, int block_mask) +{ + guint32 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 (fb, + block_x * BLOCK_SIZE, + block_y * BLOCK_SIZE, + BLOCK_SIZE, BLOCK_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + (guint8 *)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 guint32 *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) +{ + CoglHandle path_a, path_b, path_c; + + cogl_set_source_color4ub (255, 255, 255, 255); + + /* 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 */ + cogl_path_new (); + cogl_path_rectangle (BLOCK_SIZE * 3 / 4, BLOCK_SIZE / 2, + BLOCK_SIZE, BLOCK_SIZE); + cogl_path_rectangle (BLOCK_SIZE / 2, BLOCK_SIZE / 2, + BLOCK_SIZE * 3 / 4, BLOCK_SIZE); + path_a = cogl_handle_ref (cogl_get_path ()); + draw_path_at (0, 0); + + /* Create another path filling the whole block */ + cogl_path_rectangle (0, 0, BLOCK_SIZE, BLOCK_SIZE); + path_b = cogl_handle_ref (cogl_get_path ()); + draw_path_at (1, 0); + + /* Draw the first path again */ + cogl_set_path (path_a); + draw_path_at (2, 0); + + /* Draw a copy of path a */ + path_c = cogl_path_copy (path_a); + cogl_set_path (path_c); + draw_path_at (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_set_path (path_a); + cogl_path_line_to (0, BLOCK_SIZE / 2); + cogl_path_line_to (0, 0); + cogl_path_line_to (BLOCK_SIZE / 2, 0); + cogl_path_line_to (BLOCK_SIZE / 2, BLOCK_SIZE / 2); + draw_path_at (4, 0); + + /* Draw the copy again. It should not have changed */ + cogl_set_path (path_c); + draw_path_at (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_set_path (path_c); + cogl_path_line_to (BLOCK_SIZE / 2, 0); + cogl_path_line_to (BLOCK_SIZE * 3 / 4, 0); + cogl_path_line_to (BLOCK_SIZE * 3 / 4, BLOCK_SIZE / 2); + cogl_path_line_to (BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_rectangle (BLOCK_SIZE * 3 / 4, 0, BLOCK_SIZE, BLOCK_SIZE / 2); + draw_path_at (6, 0); + + /* Draw the original path again. It should not have changed */ + cogl_set_path (path_a); + draw_path_at (7, 0); + + cogl_handle_unref (path_a); + cogl_handle_unref (path_b); + cogl_handle_unref (path_c); + + /* Draw a self-intersecting path. The part that intersects should be + inverted */ + cogl_path_rectangle (0, 0, BLOCK_SIZE, BLOCK_SIZE); + cogl_path_line_to (0, BLOCK_SIZE / 2); + cogl_path_line_to (BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_line_to (BLOCK_SIZE / 2, 0); + cogl_path_close (); + draw_path_at (8, 0); + + /* Draw two sub paths. Where the paths intersect it should be + inverted */ + cogl_path_rectangle (0, 0, BLOCK_SIZE, BLOCK_SIZE); + cogl_path_rectangle (BLOCK_SIZE / 2, BLOCK_SIZE / 2, BLOCK_SIZE, BLOCK_SIZE); + draw_path_at (9, 0); + + /* Draw a clockwise outer path */ + cogl_path_move_to (0, 0); + cogl_path_line_to (BLOCK_SIZE, 0); + cogl_path_line_to (BLOCK_SIZE, BLOCK_SIZE); + cogl_path_line_to (0, BLOCK_SIZE); + cogl_path_close (); + /* Add a clockwise sub path in the upper left quadrant */ + cogl_path_move_to (0, 0); + cogl_path_line_to (BLOCK_SIZE / 2, 0); + cogl_path_line_to (BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_line_to (0, BLOCK_SIZE / 2); + cogl_path_close (); + /* Add a counter-clockwise sub path in the upper right quadrant */ + cogl_path_move_to (BLOCK_SIZE / 2, 0); + cogl_path_line_to (BLOCK_SIZE / 2, BLOCK_SIZE / 2); + cogl_path_line_to (BLOCK_SIZE, BLOCK_SIZE / 2); + cogl_path_line_to (BLOCK_SIZE, 0); + cogl_path_close (); + /* Retain the path for the next test */ + path_a = cogl_handle_ref (cogl_get_path ()); + draw_path_at (10, 0); + + /* Draw the same path again with the other fill rule */ + cogl_set_path (path_a); + cogl_path_set_fill_rule (COGL_PATH_FILL_RULE_NON_ZERO); + draw_path_at (11, 0); + + cogl_handle_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 (fb, + 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (fb), + -1, + 100); + + /* XXX: we have to push/pop a framebuffer since this test currently + * uses the legacy cogl_rectangle() api. */ + cogl_push_framebuffer (fb); + paint (&state); + cogl_pop_framebuffer (); + validate_result (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-pipeline-uniforms.c b/tests/conform/test-pipeline-uniforms.c new file mode 100644 index 0000000..da7b86b --- /dev/null +++ b/tests/conform/test-pipeline-uniforms.c @@ -0,0 +1,421 @@ +#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 (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 (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 (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, guint32 color) +{ + test_utils_check_pixel (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) +{ + /* If shaders aren't supported then we can't run the test */ + if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL)) + { + TestState state; + + init_state (&state); + + cogl_framebuffer_orthographic (fb, + 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (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"); + } + else if (cogl_test_verbose ()) + g_print ("Skipping\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..6f1b34a --- /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) +{ + guint32 *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 (fb, 0, 0, state->width, state->height, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + (guint8 *)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 */ + guint8 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 */ + guint8 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; + GError *error = NULL; + + cogl_framebuffer_orthographic (fb, + 0, 0, + state->width, + state->height, + -1, + 100); + + cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1); + + cogl_matrix_init_identity (&matrix); + cogl_framebuffer_set_modelview_matrix (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 (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 (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 (fb); + state.height = cogl_framebuffer_get_height (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..393f40a --- /dev/null +++ b/tests/conform/test-pixel-buffer.c @@ -0,0 +1,274 @@ +#include +#include + +#include "test-utils.h" + +#define TILE_SIZE 32.0f + +enum +{ + TILE_MAP, + TILE_SET_DATA, + NB_TILES, + TILE_SET_REGION, +}; + +typedef struct test_tile +{ + guint8 color[4]; + gfloat x, y; + CoglBuffer *buffer; + CoglTexture *texture; +} TestTile; + +typedef struct _TestState +{ + TestTile *tiles; + int width; + int height; +} TestState; + +static CoglTexture * +create_texture_from_bitmap (CoglBitmap *bitmap) +{ + CoglTexture *texture; + + texture = cogl_texture_new_from_bitmap (bitmap, + COGL_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGBA_8888); + + g_assert (texture != NULL); + + return texture; +} + +static void +create_map_tile (CoglContext *context, + TestTile *tile) +{ + CoglBitmap *bitmap; + CoglBuffer *buffer; + guchar *map; + unsigned int i; + unsigned int stride; + guint8 *line; + + bitmap = cogl_bitmap_new_with_size (context, + TILE_SIZE, + TILE_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888); + buffer = COGL_BUFFER (cogl_bitmap_get_buffer (bitmap)); + stride = cogl_bitmap_get_rowstride (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); + + map = cogl_buffer_map (buffer, + COGL_BUFFER_ACCESS_WRITE, + COGL_BUFFER_MAP_HINT_DISCARD); + g_assert (map); + + line = g_alloca (TILE_SIZE * 4); + for (i = 0; i < TILE_SIZE * 4; i += 4) + memcpy (line + i, tile->color, 4); + + for (i = 0; i < TILE_SIZE; i++) + memcpy (map + stride * i, line, TILE_SIZE * 4); + + cogl_buffer_unmap (buffer); + + tile->buffer = cogl_object_ref (buffer); + tile->texture = create_texture_from_bitmap (bitmap); + + cogl_object_unref (bitmap); +} + +#if 0 +static void +create_set_region_tile (CoglContext *context, + TestTile *tile) +{ + CoglBitmap *bitmap; + CoglBuffer *buffer; + guint8 bottom_color[4]; + unsigned int rowstride = 0; + guchar *data; + unsigned int i; + + bitmap = cogl_bitmap_new_with_size (context, + TILE_SIZE, + TILE_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888); + buffer = COGL_BUFFER (cogl_bitmap_get_buffer (bitmap)); + rowstride = cogl_bitmap_get_rowstride (bitmap); + + g_assert (cogl_is_pixel_buffer (buffer)); + g_assert (cogl_is_buffer (buffer)); + + /* while at it, set/get the hint */ + cogl_buffer_set_update_hint (buffer, COGL_BUFFER_UPDATE_HINT_STATIC); + g_assert (cogl_buffer_get_update_hint (buffer) == + COGL_BUFFER_UPDATE_HINT_STATIC); + + data = g_malloc (TILE_SIZE * TILE_SIZE * 4); + /* create a buffer with the data we want to copy to the buffer */ + for (i = 0; i < TILE_SIZE * TILE_SIZE * 4; i += 4) + memcpy (data + i, &tile->color, 4); + + cogl_pixel_array_set_region (buffer, + data, + TILE_SIZE, TILE_SIZE, + TILE_SIZE, + 0, 0); + + memcpy (bottom_color, tile->color, 4); + for (i = 0; i < TILE_SIZE / 2; i++) + memcpy (data + i, bottom_color, 4); + + cogl_buffer_set_data (buffer, 0, data, TILE_SIZE * TILE_SIZE * 4 / 2); + + g_free (data); + + tile->buffer = cogl_object_ref (buffer); + tile->texture = create_texture_from_bitmap (bitmap); + + cogl_object_unref (bitmap); +} +#endif + +static void +create_set_data_tile (CoglContext *context, + TestTile *tile) +{ + CoglBitmap *bitmap; + CoglBuffer *buffer; + unsigned int rowstride = 0; + gboolean res; + guchar *data; + unsigned int i; + + bitmap = cogl_bitmap_new_with_size (context, + TILE_SIZE, + TILE_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888); + buffer = COGL_BUFFER (cogl_bitmap_get_buffer (bitmap)); + rowstride = cogl_bitmap_get_rowstride (bitmap); + + g_assert (cogl_is_pixel_buffer (buffer)); + g_assert (cogl_is_buffer (buffer)); + g_assert_cmpint (cogl_buffer_get_size (buffer), ==, rowstride * TILE_SIZE); + + /* create a buffer with the data we want to copy to the buffer */ + data = g_malloc (TILE_SIZE * TILE_SIZE * 4); + for (i = 0; i < TILE_SIZE * TILE_SIZE * 4; i += 4) + memcpy (data + i, tile->color, 4); + + /* FIXME: this doesn't consider the rowstride */ + res = cogl_buffer_set_data (buffer, 0, data, TILE_SIZE * TILE_SIZE * 4); + g_assert (res); + + g_free (data); + + tile->buffer = cogl_object_ref (buffer); + tile->texture = create_texture_from_bitmap (bitmap); + + cogl_object_unref (bitmap); +} + +static void +draw_frame (TestState *state) +{ + unsigned int i; + + /* Paint the textures */ + for (i = 0; i < NB_TILES; i++) + { + CoglPipeline *pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, state->tiles[i].texture); + cogl_framebuffer_draw_rectangle (fb, + pipeline, + state->tiles[i].x, + state->tiles[i].y, + state->tiles[i].x + TILE_SIZE, + state->tiles[i].y + TILE_SIZE); + cogl_object_unref (pipeline); + } + +} + +static void +validate_tile (TestState *state, + TestTile *tile) +{ + test_utils_check_region (fb, + tile->x, tile->y, + TILE_SIZE, TILE_SIZE, + (tile->color[0] << 24) | + (tile->color[1] << 16) | + (tile->color[2] << 8) | + 0xff); +} + +static void +validate_result (TestState *state) +{ + unsigned int i; + + for (i = 0; i < NB_TILES; i++) + validate_tile (state, &state->tiles[i]); +} + +void +test_pixel_buffer (void) +{ + TestState state; + int i; + static TestTile tiles[NB_TILES] = + { + /* color x y buffer tex */ + + /* MAP */ + { { 0xff, 0x00, 0x00, 0xff }, 0.0f, 0.0f, NULL, NULL }, +#if 0 + /* SET_REGION */ + { { 0x7e, 0x7e, 0xff, 0x7e }, 0.0f, TILE_SIZE, NULL, NULL }, +#endif + /* SET_DATA */ + { { 0x7e, 0xff, 0x7e, 0xff }, 0.0f, TILE_SIZE, NULL, NULL } + }; + + state.width = cogl_framebuffer_get_width (fb); + state.height = cogl_framebuffer_get_height (fb); + cogl_framebuffer_orthographic (fb, + 0, 0, + state.width, + state.height, + -1, + 100); + + create_map_tile (ctx, &tiles[TILE_MAP]); +#if 0 + create_set_region_tile (shared_state->ctx, &tiles[TILE_SET_REGION]); +#endif + create_set_data_tile (ctx, &tiles[TILE_SET_DATA]); + + state.tiles = tiles; + + draw_frame (&state); + validate_result (&state); + + for (i = 0; i < NB_TILES; i++) + { + cogl_object_unref (state.tiles[i].buffer); + cogl_object_unref (state.tiles[i].texture); + } + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} + diff --git a/tests/conform/test-point-size.c b/tests/conform/test-point-size.c new file mode 100644 index 0000000..6f114d3 --- /dev/null +++ b/tests/conform/test-point-size.c @@ -0,0 +1,101 @@ +#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 *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++) + { + gboolean in_point = x >= 1 && x <= 2 && y >= 1 && y <= 2; + guint32 expected_pixel = in_point ? 0x00ff00ff : 0xff0000ff; + + test_utils_check_pixel (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 (fb); + int fb_height = cogl_framebuffer_get_height (fb); + int point_size; + int x_pos; + + cogl_framebuffer_orthographic (fb, + 0, 0, /* x_1, y_1 */ + fb_width, /* x_2 */ + fb_height /* y_2 */, + -1, 100 /* near/far */); + + cogl_framebuffer_clear4f (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 (ctx); + CoglVertexP2 point = { x_pos + POINT_BOX_SIZE / 2, + POINT_BOX_SIZE / 2 }; + CoglPrimitive *prim = + cogl_primitive_new_p2 (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_framebuffer_draw_primitive (fb, + pipeline, + prim); + + 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 (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..d8c450e --- /dev/null +++ b/tests/conform/test-point-sprite.c @@ -0,0 +1,131 @@ +#include + +#include "test-utils.h" + +#define POINT_SIZE 8 + +static const CoglVertexP2T2 +point = + { + POINT_SIZE, POINT_SIZE, + 0.0f, 0.0f + }; + +static const guint8 +tex_data[3 * 2 * 2] = + { + 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, + 0x00, 0xff, 0xff, 0xff, 0x00, 0x00 + }; + +void +test_point_sprite (void) +{ + int fb_width = cogl_framebuffer_get_width (fb); + int fb_height = cogl_framebuffer_get_height (fb); + CoglPrimitive *prim; + GError *error = NULL; + CoglTexture2D *tex_2d; + CoglPipeline *pipeline, *solid_pipeline; + gboolean res; + + cogl_framebuffer_orthographic (fb, + 0, 0, /* x_1, y_1 */ + fb_width, /* x_2 */ + fb_height /* y_2 */, + -1, 100 /* near/far */); + + cogl_framebuffer_clear4f (fb, + COGL_BUFFER_BIT_COLOR, + 1.0f, 1.0f, 1.0f, 1.0f); + + tex_2d = cogl_texture_2d_new_from_data (ctx, + 2, 2, /* width/height */ + COGL_PIXEL_FORMAT_RGB_888, + COGL_PIXEL_FORMAT_ANY, + 6, /* row stride */ + tex_data, + &error); + g_assert (tex_2d != NULL); + g_assert (error == NULL); + + pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex_2d)); + + res = cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline, + /* layer_index */ + 0, + /* enable */ + TRUE, + &error); + g_assert (res == TRUE); + g_assert (error == NULL); + + 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); + + prim = cogl_primitive_new_p2t2 (ctx, + COGL_VERTICES_MODE_POINTS, + 1, /* n_vertices */ + &point); + + cogl_framebuffer_draw_primitive (fb, + pipeline, + prim); + + /* Render the primitive again without point sprites to make sure + disabling it works */ + solid_pipeline = cogl_pipeline_copy (pipeline); + cogl_pipeline_set_layer_point_sprite_coords_enabled (solid_pipeline, + /* layer_index */ + 0, + /* enable */ + FALSE, + &error); + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, + POINT_SIZE * 2, /* x */ + 0.0f, /* y */ + 0.0f /* z */); + cogl_framebuffer_draw_primitive (fb, + solid_pipeline, + prim); + cogl_framebuffer_pop_matrix (fb); + + cogl_object_unref (prim); + cogl_object_unref (solid_pipeline); + cogl_object_unref (pipeline); + cogl_object_unref (tex_2d); + + test_utils_check_pixel (fb, + POINT_SIZE - POINT_SIZE / 4, + POINT_SIZE - POINT_SIZE / 4, + 0x0000ffff); + test_utils_check_pixel (fb, + POINT_SIZE + POINT_SIZE / 4, + POINT_SIZE - POINT_SIZE / 4, + 0x00ff00ff); + test_utils_check_pixel (fb, + POINT_SIZE - POINT_SIZE / 4, + POINT_SIZE + POINT_SIZE / 4, + 0x00ffffff); + test_utils_check_pixel (fb, + POINT_SIZE + POINT_SIZE / 4, + POINT_SIZE + POINT_SIZE / 4, + 0xff0000ff); + + /* 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 (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"); +} diff --git a/tests/conform/test-primitive.c b/tests/conform/test-primitive.c new file mode 100644 index 0000000..3dc5820 --- /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, guint32 *expected_color); + +static CoglPrimitive * +test_prim_p2 (CoglContext *ctx, guint32 *expected_color) +{ + static const CoglVertexP2 verts[] = + { { 0, 0 }, { 0, 10 }, { 10, 0 } }; + + return cogl_primitive_new_p2 (ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3 (CoglContext *ctx, guint32 *expected_color) +{ + static const CoglVertexP3 verts[] = + { { 0, 0, 0 }, { 0, 10, 0 }, { 10, 0, 0 } }; + + return cogl_primitive_new_p3 (ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p2c4 (CoglContext *ctx, guint32 *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 (ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3c4 (CoglContext *ctx, guint32 *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 (ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p2t2 (CoglContext *ctx, guint32 *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 (ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3t2 (CoglContext *ctx, guint32 *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 (ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p2t2c4 (CoglContext *ctx, guint32 *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 (ctx, + COGL_VERTICES_MODE_TRIANGLES, + 3, /* n_vertices */ + verts); +} + +static CoglPrimitive * +test_prim_p3t2c4 (CoglContext *ctx, guint32 *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 (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; + guint8 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 = cogl_texture_new_from_data (2, 1, /* size */ + COGL_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGB_888, + COGL_PIXEL_FORMAT_ANY, + 6, /* rowstride */ + tex_data); + pipeline = cogl_pipeline_new (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; + guint32 expected_color = PRIM_COLOR; + + prim = test_prim_funcs[i] (ctx, &expected_color); + + cogl_framebuffer_push_matrix (fb); + cogl_framebuffer_translate (fb, i * 10, 0, 0); + cogl_framebuffer_draw_primitive (fb, pipeline, prim); + cogl_framebuffer_pop_matrix (fb); + + test_utils_check_pixel (fb, i * 10 + 2, 2, expected_color); + + cogl_object_unref (prim); + } + + cogl_object_unref (pipeline); +} + +static gboolean +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 guint16 indices_data[2] = { 1, 2 }; + CoglAttributeBuffer *buffer = + cogl_attribute_buffer_new (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 (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 (fb); + state.fb_height = cogl_framebuffer_get_height (fb); + + cogl_framebuffer_orthographic (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..7161d0f --- /dev/null +++ b/tests/conform/test-read-texture-formats.c @@ -0,0 +1,201 @@ +#include +#include + +#include "test-utils.h" + +/* + * This tests reading back an RGBA texture in all of the available + * pixel formats + */ + +static const guint8 tex_data[4] = { 0x12, 0x34, 0x56, 0x78 }; + +static void +test_read_byte (CoglTexture2D *tex_2d, + CoglPixelFormat format, + guint8 expected_byte) +{ + guint8 received_byte; + + cogl_texture_get_data (COGL_TEXTURE (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; + guint16 received_value; + guint16 expected_value = 0; + char *received_value_str; + char *expected_value_str; + int bits_sum = 0; + + cogl_texture_get_data (COGL_TEXTURE (tex_2d), + format, + 2, /* rowstride */ + (guint8 *) &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, + guint32 expected_pixel) +{ + guint8 pixel[4]; + + cogl_texture_get_data (COGL_TEXTURE (tex_2d), + format, + 4, /* rowstride */ + pixel); + + test_utils_compare_pixel (pixel, expected_pixel); +} + +static void +test_read_8888 (CoglTexture2D *tex_2d, + CoglPixelFormat format, + guint32 expected_pixel) +{ + guint32 received_pixel; + char *received_value_str; + char *expected_value_str; + + cogl_texture_get_data (COGL_TEXTURE (tex_2d), + format, + 4, /* rowstride */ + (guint8 *) &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; + guint32 received_value; + guint32 expected_value = 0; + char *received_value_str; + char *expected_value_str; + int bits_sum = 0; + + cogl_texture_get_data (COGL_TEXTURE (tex_2d), + format, + 4, /* rowstride */ + (guint8 *) &received_value); + + va_start (ap, format); + + /* Convert the va args into a single 32-bit expected value */ + while ((bits = va_arg (ap, int)) != -1) + { + guint32 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 (ctx, + 1, 1, /* width / height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 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 + + 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 (g_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..cf6d778 --- /dev/null +++ b/tests/conform/test-snippets.c @@ -0,0 +1,713 @@ +#include + +#include + +#include "test-utils.h" + +typedef struct _TestState +{ + int padding; +} TestState; + +typedef void (* SnippetTestFunc) (TestState *state); + +static CoglPipeline * +create_texture_pipeline (TestState *state) +{ + CoglPipeline *pipeline; + CoglTexture *tex; + static const guint8 tex_data[] = + { + 0xff, 0x00, 0x00, 0xff, /* red */ 0x00, 0xff, 0x00, 0xff, /* green */ + 0x00, 0x00, 0xff, 0xff, /* blue */ 0xff, 0xff, 0x00, 0xff, /* yellow */ + }; + + tex = cogl_texture_new_from_data (2, 2, /* width/height */ + COGL_TEXTURE_NO_ATLAS, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + COGL_PIXEL_FORMAT_ANY, + 8, /* rowstride */ + tex_data); + + pipeline = cogl_pipeline_new (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 (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 (fb, pipeline, 0, 0, 10, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (fb, 5, 5, 0xffff00ff); +} + +static void +simple_vertex_snippet (TestState *state) +{ + CoglPipeline *pipeline; + CoglSnippet *snippet; + + /* Simple vertex snippet */ + pipeline = cogl_pipeline_new (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 (fb, pipeline, 10, 0, 20, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (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 (fb, + pipeline, + 20, 0, 30, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (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 (fb, pipeline, 30, 0, 40, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (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 (fb, pipeline, 40, 0, 50, 10); + + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (ctx); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_framebuffer_draw_rectangle (fb, pipeline, 50, 0, 60, 10); + cogl_object_unref (pipeline); + + pipeline = cogl_pipeline_new (ctx); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_framebuffer_draw_rectangle (fb, pipeline, 60, 0, 70, 10); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (fb, 55, 5, 0x00ff00ff); + test_utils_check_pixel (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 (ctx); + cogl_pipeline_add_snippet (pipeline, snippet); + cogl_framebuffer_draw_rectangle (fb, pipeline, 70, 0, 80, 10); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (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 (fb, + pipeline, + 80, 0, 90, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (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 (fb, pipeline, 0, 0, 10, 10); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (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 (fb, + pipeline, + 90, 0, 100, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + cogl_object_unref (snippet); + + test_utils_check_pixel (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 (fb, + pipeline, + 100, 0, 110, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (fb, + pipeline, + 110, 0, 120, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (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 (fb, + pipeline, + 120, 0, 130, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (fb, + pipeline, + 130, 0, 140, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (fb, + pipeline, + 140, 0, 150, 10, + 0, 0, 0, 0); + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (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 (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 (fb, &identity_matrix); + + cogl_framebuffer_draw_rectangle (fb, pipeline, 150, 0, 160, 10); + cogl_object_unref (pipeline); + + /* Restore the projection matrix */ + cogl_framebuffer_set_projection_matrix (fb, &matrix); + + test_utils_check_pixel (fb, 155, 5, 0xff00ffff); +} + +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 (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 (fb, pipeline, 160, 0, 170, 10); + cogl_object_unref (pipeline); + + test_utils_check_pixel (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 (ctx, 0xff0000ff); + tex2 = test_utils_create_color_texture (ctx, 0x00ff00ff); + + pipeline = cogl_pipeline_new (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 (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 (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_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 (fb, + COGL_BUFFER_BIT_COLOR, + 0, 0, 0, 1); + + tests[i] (state); + } +} + +void +test_snippets (void) +{ + /* If shaders aren't supported then we can't run the test */ + if (cogl_features_available (COGL_FEATURE_SHADERS_GLSL)) + { + TestState state; + + cogl_framebuffer_orthographic (fb, + 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (fb), + -1, + 100); + + run_tests (&state); + + if (cogl_test_verbose ()) + g_print ("OK\n"); + } + else if (cogl_test_verbose ()) + g_print ("Skipping\n"); +} diff --git a/tests/conform/test-sparse-pipeline.c b/tests/conform/test-sparse-pipeline.c new file mode 100644 index 0000000..a88f50b --- /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 (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 (ctx, 0xff0000ff); + tex2 = test_utils_create_color_texture (ctx, 0x00ff00ff); + + pipeline = cogl_pipeline_new (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 (fb, pipeline, -1, -1, 1, 1); + + test_utils_check_pixel (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 (fb); + state.fb_height = cogl_framebuffer_get_height (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..261f4d7 --- /dev/null +++ b/tests/conform/test-sub-texture.c @@ -0,0 +1,332 @@ +#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 guint32 +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; + guint8 *data = g_malloc (SOURCE_SIZE * SOURCE_SIZE * 4); + CoglTexture2D *tex; + GError *error = NULL; + + /* 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++) + { + guint8 *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++) + { + guint32 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 (ctx, + SOURCE_SIZE, SOURCE_SIZE, + COGL_PIXEL_FORMAT_RGBA_8888, + COGL_PIXEL_FORMAT_ANY, + SOURCE_SIZE * 4, + data, + &error); + g_assert_no_error (error); + return tex; +} + +static CoglTexture2D * +create_test_texture (TestState *state) +{ + CoglTexture2D *tex; + guint8 *data = g_malloc (256 * 256 * 4), *p = data; + int x, y; + GError *error = NULL; + + /* 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 (ctx, + 256, 256, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + COGL_PIXEL_FORMAT_ANY, + 256 * 4, + data, + &error); + g_assert_no_error (error); + + g_free (data); + + return tex; +} + +static void +paint (TestState *state) +{ + CoglTexture2D *full_texture; + CoglSubTexture *sub_texture, *sub_sub_texture; + CoglPipeline *pipeline = cogl_pipeline_new (ctx); + + /* Create a sub texture of the bottom right quarter of the texture */ + sub_texture = cogl_sub_texture_new (ctx, + COGL_TEXTURE (state->tex), + DIVISION_WIDTH, + DIVISION_HEIGHT, + DIVISION_WIDTH, + DIVISION_HEIGHT); + + /* Paint it */ + cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture)); + cogl_object_unref (sub_texture); + cogl_framebuffer_draw_rectangle (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 (ctx, + COGL_TEXTURE (state->tex), + 0, 0, + SOURCE_SIZE, + DIVISION_HEIGHT); + cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture)); + cogl_object_unref (sub_texture); + cogl_framebuffer_draw_textured_rectangle (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 (ctx, + COGL_TEXTURE (full_texture), + 20, 10, 30, 20); + cogl_object_unref (full_texture); + sub_sub_texture = cogl_sub_texture_new (ctx, + COGL_TEXTURE (sub_texture), + 20, 10, 10, 10); + cogl_object_unref (sub_texture); + cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_sub_texture)); + cogl_object_unref (sub_sub_texture); + cogl_framebuffer_draw_rectangle (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, + guint32 color) +{ + test_utils_check_region (fb, + xpos + TEST_INSET, + ypos + TEST_INSET, + width - TEST_INSET - 2, + height - TEST_INSET - 2, + color); +} + +static guint8 * +create_update_data (void) +{ + guint8 *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; + guint8 *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 (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 (ctx, + COGL_TEXTURE (state->tex), + SOURCE_SIZE / 4, + SOURCE_SIZE / 4, + SOURCE_SIZE / 2, + SOURCE_SIZE / 2); + tex_width = cogl_texture_get_width (COGL_TEXTURE (sub_texture)); + tex_height = cogl_texture_get_height (COGL_TEXTURE (sub_texture)); + p = texture_data = g_malloc (tex_width * tex_height * 4); + cogl_texture_get_data (COGL_TEXTURE (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); + guint32 reference = corner_colors[div_x + div_y * SOURCE_DIVISIONS_X] >> 8; + guint32 color = GUINT32_FROM_BE (*((guint32 *)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 (ctx, + COGL_TEXTURE (test_tex), + 64, 64, 128, 128); + /* Update the center half of the sub texture */ + texture_data = create_update_data (); + cogl_texture_set_region (COGL_TEXTURE (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 (COGL_TEXTURE (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 (fb, + 0, 0, + cogl_framebuffer_get_width (fb), + cogl_framebuffer_get_height (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..777d023 --- /dev/null +++ b/tests/conform/test-texture-3d.c @@ -0,0 +1,285 @@ +#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; + guint8 *data = g_malloc (TEX_IMAGE_STRIDE * TEX_DEPTH); + guint8 *p = data; + CoglTexture3D *tex; + GError *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, + COGL_PIXEL_FORMAT_ANY, + 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 = COGL_TEXTURE (create_texture_3d (ctx)); + CoglPipeline *pipeline = cogl_pipeline_new (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 (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 (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 (ctx, + TEX_DEPTH), + 6 * TEX_DEPTH); + + cogl_framebuffer_draw_primitive (fb, pipeline, primitive); + + 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 (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; + guint8 tex_data[4]; + + cogl_framebuffer_clear4f (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 (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 (ctx, + 1, 1, /* width/height */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + tex_data, + NULL); + cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (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 (ctx, + 1, 1, 1, /* width/height/depth */ + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + 4, /* image_stride */ + tex_data, + NULL); + cogl_pipeline_set_layer_texture (pipeline, 1, COGL_TEXTURE (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 (fb, pipeline, 0, 0, 10, 10); + + test_utils_check_pixel (fb, 5, 5, 0xffff00ff); + + cogl_object_unref (tex_2d); + cogl_object_unref (tex_3d); + cogl_object_unref (pipeline); +} + +void +test_texture_3d (void) +{ + /* Check whether GL supports the rectangle extension. If not we'll + just assume the test passes */ + if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) + { + TestState state; + + state.fb_width = cogl_framebuffer_get_width (fb); + state.fb_height = cogl_framebuffer_get_height (fb); + + cogl_framebuffer_orthographic (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"); + } + else if (cogl_test_verbose ()) + g_print ("Skipping\n"); +} + diff --git a/tests/conform/test-utils.c b/tests/conform/test-utils.c new file mode 100644 index 0000000..2259173 --- /dev/null +++ b/tests/conform/test-utils.c @@ -0,0 +1,228 @@ +#define COGL_ENABLE_EXPERIMENTAL_2_0_API +#include +#include + +#include "test-utils.h" + +#define FB_WIDTH 512 +#define FB_HEIGHT 512 + +static gboolean cogl_test_is_verbose; + +CoglContext *ctx; +CoglFramebuffer *fb; + +void +test_utils_init (TestFlags flags) +{ + static int counter = 0; + GError *error = NULL; + CoglOnscreen *onscreen = NULL; + CoglDisplay *display; + CoglRenderer *renderer; + gboolean missing_requirement = FALSE; + + 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 (g_getenv ("COGL_TEST_VERBOSE") || g_getenv ("V")) + cogl_test_is_verbose = TRUE; + + 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); + + ctx = cogl_context_new (NULL, &error); + if (!ctx) + g_critical ("Failed to create a CoglContext: %s", error->message); + + display = cogl_context_get_display (ctx); + renderer = cogl_display_get_renderer (display); + + if (flags & TEST_REQUIREMENT_GL && + cogl_renderer_get_driver (renderer) != COGL_DRIVER_GL) + { + missing_requirement = TRUE; + } + + if (flags & TEST_REQUIREMENT_NPOT && + !cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT)) + { + missing_requirement = TRUE; + } + + if (flags & TEST_REQUIREMENT_TEXTURE_3D && + !cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) + { + missing_requirement = TRUE; + } + + if (flags & TEST_REQUIREMENT_POINT_SPRITE && + !cogl_has_feature (ctx, COGL_FEATURE_ID_POINT_SPRITE)) + { + missing_requirement = TRUE; + } + + if (flags & TEST_KNOWN_FAILURE) + { + missing_requirement = TRUE; + } + + if (getenv ("COGL_TEST_ONSCREEN")) + { + onscreen = cogl_onscreen_new (ctx, 640, 480); + fb = COGL_FRAMEBUFFER (onscreen); + } + else + { + CoglHandle offscreen; + CoglHandle tex = cogl_texture_2d_new_with_size (ctx, + FB_WIDTH, FB_HEIGHT, + COGL_PIXEL_FORMAT_ANY, + &error); + if (!tex) + g_critical ("Failed to allocate texture: %s", error->message); + + offscreen = cogl_offscreen_new_to_texture (tex); + fb = COGL_FRAMEBUFFER (offscreen); + } + + if (!cogl_framebuffer_allocate (fb, &error)) + g_critical ("Failed to allocate framebuffer: %s", error->message); + + if (onscreen) + cogl_onscreen_show (onscreen); + + cogl_framebuffer_clear4f (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"); +} + +void +test_utils_fini (void) +{ + if (fb) + cogl_object_unref (fb); + + if (ctx) + cogl_object_unref (ctx); +} + +static gboolean +compare_component (int a, int b) +{ + return ABS (a - b) <= 1; +} + +void +test_utils_compare_pixel (const guint8 *screen_pixel, guint32 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)) + { + guint32 screen_pixel_num = GUINT32_FROM_BE (*(guint32 *) 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 *fb, + int x, int y, guint32 expected_pixel) +{ + guint8 pixel[4]; + + cogl_framebuffer_read_pixels (fb, + x, y, 1, 1, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + pixel); + + test_utils_compare_pixel (pixel, expected_pixel); +} + +void +test_utils_check_pixel_rgb (CoglFramebuffer *fb, + int x, int y, int r, int g, int b) +{ + test_utils_check_pixel (fb, x, y, (r << 24) | (g << 16) | (b << 8)); +} + +void +test_utils_check_region (CoglFramebuffer *fb, + int x, int y, + int width, int height, + guint32 expected_rgba) +{ + guint8 *pixels, *p; + + pixels = p = g_malloc (width * height * 4); + cogl_framebuffer_read_pixels (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, + guint32 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, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + (guint8 *) &color, + NULL); + + return COGL_TEXTURE (tex_2d); +} + +gboolean +cogl_test_verbose (void) +{ + return cogl_test_is_verbose; +} diff --git a/tests/conform/test-utils.h b/tests/conform/test-utils.h new file mode 100644 index 0000000..727aea8 --- /dev/null +++ b/tests/conform/test-utils.h @@ -0,0 +1,115 @@ +#ifndef _TEST_UTILS_H_ +#define _TEST_UTILS_H_ + +/* 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_POINT_SPRITE = 1<<4 +} TestFlags; + +extern CoglContext *ctx; +extern CoglFramebuffer *fb; + +void +test_utils_init (TestFlags flags); + +void +test_utils_fini (void); + +/* + * 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, guint32 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, + guint32 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 guint8 *screen_pixel, guint32 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, + guint32 color); + +/* cogl_test_verbose: + * + * Queries if the user asked for verbose output or not. + */ +gboolean +cogl_test_verbose (void); + +#endif /* _TEST_UTILS_H_ */ diff --git a/tests/conform/test-wrap-modes.c b/tests/conform/test-wrap-modes.c new file mode 100644 index 0000000..cb75705 --- /dev/null +++ b/tests/conform/test-wrap-modes.c @@ -0,0 +1,294 @@ +#include +#include + +#include "test-utils.h" + +#define TEX_SIZE 4 + +typedef struct _TestState +{ + int width; + int height; + CoglTexture *texture; +} TestState; + +static CoglTexture * +create_texture (CoglTextureFlags flags) +{ + guint8 *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 = cogl_texture_new_from_data (TEX_SIZE, TEX_SIZE, flags, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + COGL_PIXEL_FORMAT_ANY, + 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 (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 (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) +{ + guint8 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 (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++) + { + guint8 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 (COGL_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 (COGL_TEXTURE_NONE); + cogl_push_matrix (); + cogl_translate (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 (fb); + state.height = cogl_framebuffer_get_height (fb); + + cogl_framebuffer_orthographic (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 (fb); + paint (&state); + cogl_pop_framebuffer (); + + if (cogl_test_verbose ()) + g_print ("OK\n"); +} diff --git a/tests/conform/test-write-texture-formats.c b/tests/conform/test-write-texture-formats.c new file mode 100644 index 0000000..3081182 --- /dev/null +++ b/tests/conform/test-write-texture-formats.c @@ -0,0 +1,187 @@ +#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, + guint32 expected_pixel) +{ + guint32 received_pixel; + char *received_value_str; + char *expected_value_str; + + cogl_texture_get_data (texture, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 4, /* rowstride */ + (guint8 *) &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_write_byte (CoglContext *context, + CoglPixelFormat format, + guint8 byte, + guint32 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, + guint16 value, + guint32 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 */ + (guint8 *) &value); + + test_color (texture, expected_pixel); + + cogl_object_unref (texture); +} + +static void +test_write_bytes (CoglContext *context, + CoglPixelFormat format, + guint32 value, + guint32 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 */ + (guint8 *) &value); + + test_color (texture, expected_pixel); + + cogl_object_unref (texture); +} + +static void +test_write_int (CoglContext *context, + CoglPixelFormat format, + guint32 expected_pixel, + ...) +{ + va_list ap; + int bits; + guint32 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) + { + guint32 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 */ + (guint8 *) &tex_data); + + test_color (texture, expected_pixel); + + cogl_object_unref (texture); +} + +void +test_write_texture_formats (void) +{ + test_write_byte (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 (ctx, COGL_PIXEL_FORMAT_G_8, 0x34, 0x340000ff); +#endif + + test_write_short (ctx, COGL_PIXEL_FORMAT_RGB_565, 0x0843, 0x080819ff); + test_write_short (ctx, COGL_PIXEL_FORMAT_RGBA_4444_PRE, 0x1234, 0x11223344); + test_write_short (ctx, COGL_PIXEL_FORMAT_RGBA_5551_PRE, 0x0887, 0x081019ff); + + test_write_bytes (ctx, COGL_PIXEL_FORMAT_RGB_888, 0x123456ff, 0x123456ff); + test_write_bytes (ctx, COGL_PIXEL_FORMAT_BGR_888, 0x563412ff, 0x123456ff); + + test_write_bytes (ctx, COGL_PIXEL_FORMAT_RGBA_8888_PRE, + 0x12345678, 0x12345678); + test_write_bytes (ctx, COGL_PIXEL_FORMAT_BGRA_8888_PRE, + 0x56341278, 0x12345678); + test_write_bytes (ctx, COGL_PIXEL_FORMAT_ARGB_8888_PRE, + 0x78123456, 0x12345678); + test_write_bytes (ctx, COGL_PIXEL_FORMAT_ABGR_8888_PRE, + 0x78563412, 0x12345678); + + test_write_int (ctx, COGL_PIXEL_FORMAT_RGBA_1010102_PRE, + 0x123456ff, + 10, 0x12, 10, 0x34, 10, 0x56, 2, 0xff, + -1); + test_write_int (ctx, COGL_PIXEL_FORMAT_BGRA_1010102_PRE, + 0x123456ff, + 10, 0x56, 10, 0x34, 10, 0x12, 2, 0xff, + -1); + test_write_int (ctx, COGL_PIXEL_FORMAT_ARGB_2101010_PRE, + 0x123456ff, + 2, 0xff, 10, 0x12, 10, 0x34, 10, 0x56, + -1); + test_write_int (ctx, COGL_PIXEL_FORMAT_ABGR_2101010_PRE, + 0x123456ff, + 2, 0xff, 10, 0x56, 10, 0x34, 10, 0x12, + -1); + + if (g_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..6c3a7ef --- /dev/null +++ b/tests/data/Makefile.in @@ -0,0 +1,466 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = \ + $(top_srcdir)/build/autotools/as-compiler-flag.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/introspection.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_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +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_DEFINES = @COGL_DEFINES@ +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_HEADER_INCLUDES = @COGL_GL_HEADER_INCLUDES@ +COGL_GL_LIBNAME = @COGL_GL_LIBNAME@ +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@ +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@ +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_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ_VERSION = @GLIB_REQ_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +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@ +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@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UPROF_REQ_VERSION = @UPROF_REQ_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @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_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@ +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 +TAGS: + +ctags: CTAGS +CTAGS: + + +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 \ + 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 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 +}