Merge pull request #10749 from libretro/vitagl

VitaGL fixes
This commit is contained in:
Francisco José García García 2020-05-31 17:14:23 +02:00 committed by GitHub
commit ec336442bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 2946 additions and 816 deletions

View File

@ -2100,7 +2100,7 @@ ifeq ($(HAVE_MATH_NEON), 1)
endif
ifeq ($(HAVE_VITAGL), 1)
DEFINES += -DHAVE_VITAGL -DTRANSPOSE_MATRICES
DEFINES += -DHAVE_VITAGL -DSTB_DXT_IMPLEMENTATION -DSKIP_ERROR_HANDLING
INCLUDE_DIRS += -I$(DEPS_DIR)/vitaGL/source
SOURCES := $(DEPS_DIR)/vitaGL/source $(DEPS_DIR)/vitaGL/source/utils
OBJ += $(patsubst %.c,%.o,$(foreach dir,$(SOURCES), $(wildcard $(dir)/*.c)))

View File

@ -1,5 +1,6 @@
TARGET := retroarch_vita
DEBUG ?= 0
HAVE_FILE_LOGGER = 1
GRIFFIN_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
@ -181,6 +182,10 @@ vpksend: $(TARGET).vpk
send: $(TARGET).self
curl -T $< ftp://$(PSVITAIP):1337/ux0:/app/$(VITA_TITLE_ID)/eboot.bin
launch: $(TARGET).self
curl -T $< ftp://$(PSVITAIP):1337/ux0:/app/$(VITA_TITLE_ID)/eboot.bin
echo "launch $(VITA_TITLE_ID)" | nc ${PSVITAIP} 1338
.PHONY: clean all send vpksend
.PRECIOUS: %.depend

674
deps/vitaGL/COPYING vendored Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -2,8 +2,6 @@ TARGET := libvitaGL
SOURCES := source source/utils
SHADERS := shaders
LIBS = -lc -lm -lSceGxm_stub -lSceDisplay_stub
ifeq ($(HAVE_SBRK),1)
SOURCES += source/hacks
endif
@ -16,7 +14,7 @@ OBJS := $(CFILES:.c=.o)
PREFIX = arm-vita-eabi
CC = $(PREFIX)-gcc
AR = $(PREFIX)-gcc-ar
CFLAGS = -g -Wl,-q -O2 -ffast-math -mtune=cortex-a9 -mfpu=neon -flto -ftree-vectorize -DTRANSPOSE_MATRICES
CFLAGS = -g -Wl,-q -O2 -ffast-math -mtune=cortex-a9 -mfpu=neon -flto -ftree-vectorize -DSTB_DXT_IMPLEMENTATION
ASFLAGS = $(CFLAGS)
all: $(TARGET).a
@ -25,12 +23,12 @@ $(TARGET).a: $(OBJS)
$(AR) -rc $@ $^
%_f.h:
psp2cgc -profile sce_fp_psp2 $(@:_f.h=_f.cg) -Wperf -fastprecision -O3 -o $(@:_f.h=_f.gxp)
psp2cgc -profile sce_fp_psp2 $(@:_f.h=_f.cg) -Wperf -o $(@:_f.h=_f.gxp)
bin2c $(@:_f.h=_f.gxp) source/shaders/$(notdir $(@)) $(notdir $(@:_f.h=_f))
@rm -rf $(@:_f.h=_f.gxp)
%_v.h:
psp2cgc -profile sce_vp_psp2 $(@:_v.h=_v.cg) -Wperf -fastprecision -O3 -o $(@:_v.h=_v.gxp)
psp2cgc -profile sce_vp_psp2 $(@:_v.h=_v.cg) -Wperf -o $(@:_v.h=_v.gxp)
bin2c $(@:_v.h=_v.gxp) source/shaders/$(notdir $(@:_v.h=_v.h)) $(notdir $(@:_v.h=_v))
@rm -rf $(@:_v.h=_v.gxp)

View File

@ -1,6 +1,10 @@
# vitaGL
vitaGL is a wrapper between openGL and sceGxm. It allows to use a subset of openGL functions with fully hardware acceleration by translating the code to sceGxm equivalent.
# Build Instructions
In order to build vitaGL use the following command: `make HAVE_SBRK=1 install`.
If you already have a newlib sbrk replacement in your app (eg. RetroArch), use instead this command: `make install`.
# Samples
You can find samples in the *samples* folder in this repository.
@ -22,6 +26,9 @@ Direct OpenGL Usage:<br>
[vitaXash3D](https://vitadb.rinnegatamante.it/#/info/365) - Port of Xash3D (Half Life, Counter Strike 1.6)<br>
[Fade to Black](https://vitadb.rinnegatamante.it/#/info/367) - Port of Fade to Black<br>
[vitaVoyager](https://vitadb.rinnegatamante.it/#/info/367) - Port of lilium-voyager (Star Trek Voyager: Elite Force)<br>
[Daedalus X64](https://github.com/Rinnegatamante/daedalusx64-vitagl) - Port of Daedalus X64 (N64 Emulator)<br>
[RetroArch](https://github.com/libretro/RetroArch) - Vita's GL1 video driver of RetroArch<br>
[vitaET](https://github.com/Rinnegatamante/vitaET) - Port of ET:Legacy (Wolfenstein: Enemy Territory)<br>
Libraries:<br>
[sdl12_gl](https://github.com/Rinnegatamante/SDL-Vita/tree/sdl12_gl/src) - SDL 1.2 Vita port adapted to work with vitaGL as renderer<br>

View File

@ -1,5 +1,7 @@
float4 main(float2 position) : POSITION
float4 main(unsigned int idx : INDEX, uniform float4 position) : POSITION
{
return float4(position, 1.f, 1.f);
float x = (idx == 1 || idx == 2) ? position[1] : position[0];
float y = (idx == 2 || idx == 3) ? position[3] : position[2];
return float4(x, y, 1.f, 1.f);
}

View File

@ -6,6 +6,6 @@ void main(
float4 out vColor: COLOR)
{
vPosition = mul(float4(aPosition, 1.f), wvp);
vColor = float4(aColor, 1.0);
vColor = float4(aColor, 1.f);
}

View File

@ -1,6 +1,6 @@
float4 main(
float2 vTexcoord : TEXCOORD0,
float vFog : FOG,
float4 coords: WPOS,
uniform sampler2D tex,
uniform float alphaCut,
uniform int alphaOp,
@ -8,7 +8,10 @@
uniform int texEnv,
uniform int fog_mode,
uniform float4 fogColor,
uniform float4 texEnvColor
uniform float4 texEnvColor,
uniform float fog_near,
uniform float fog_far,
uniform float fog_density
)
{
float4 texColor = tex2D(tex, vTexcoord);
@ -62,6 +65,17 @@
// Fogging
if (fog_mode < 3){
float vFog;
if (fog_mode == 0){ // GL_LINEAR
vFog = (fog_far - coords.z) / (fog_far - fog_near);
}else if (fog_mode == 1){ // GL_EXP
vFog = exp(-fog_density * coords.z);
}else{ // GL_EXP2
const float LOG2 = -1.442695;
float d = fog_density * coords.z;
vFog = exp(d * d * LOG2);
}
vFog = clamp(vFog, 0.0, 1.0);
texColor.rgb = lerp(fogColor.rgb, texColor.rgb, vFog);
}

View File

@ -1,14 +1,17 @@
float4 main(
float2 vTexcoord : TEXCOORD0,
float4 vColor : COLOR,
float vFog : FOG,
float4 coords: WPOS,
uniform sampler2D tex,
uniform float alphaCut,
uniform int alphaOp,
uniform int texEnv,
uniform int fog_mode,
uniform float4 fogColor,
uniform float4 texEnvColor
uniform float4 texEnvColor,
uniform float fog_near,
uniform float fog_far,
uniform float fog_density
)
{
float4 texColor = tex2D(tex, vTexcoord);
@ -62,6 +65,17 @@
// Fogging
if (fog_mode < 3){
float vFog;
if (fog_mode == 0){ // GL_LINEAR
vFog = (fog_far - coords.z) / (fog_far - fog_near);
}else if (fog_mode == 1){ // GL_EXP
vFog = exp(-fog_density * coords.z);
}else{ // GL_EXP2
const float LOG2 = -1.442695;
float d = fog_density * coords.z;
vFog = exp(d * d * LOG2);
}
vFog = clamp(vFog, 0.0, 1.0);
texColor.rgb = lerp(fogColor.rgb, texColor.rgb, vFog);
}

View File

@ -3,15 +3,10 @@ void main(
float2 texcoord,
float4 color,
column_major uniform float4x4 wvp,
uniform int fog_mode,
uniform int clip_plane0, // In the future this can turn into an array to support other planes
uniform float4 clip_plane0_eq, // In the future this can turn into an array to support other planes
uniform float4x4 modelview,
uniform float fog_near,
uniform float fog_far,
uniform float fog_density,
float4 out vPosition : POSITION,
float out vFog : FOG,
float2 out vTexcoord : TEXCOORD0,
float4 out vColor : COLOR,
float out vClip : CLP0)
@ -27,21 +22,6 @@ void main(
}
vPosition = mul(pos4, wvp);
if (fog_mode > 2) { // Fogging disabled
vFog = 1.0f;
} else {
float dist = length(vPosition.xyz);
if (fog_mode == 0) { // GL_LINEAR
vFog = (fog_far - dist) / (fog_far - fog_near);
} else if (fog_mode == 1) { // GL_EXP
vFog = exp(-fog_density * dist);
} else { // GL_EXP2
const float LOG2 = -1.442695;
float d = fog_density * dist;
vFog = exp(d * d * LOG2);
}
vFog = clamp(vFog, 0.0, 1.0);
}
vTexcoord = texcoord;
vColor = color;
}

View File

@ -2,15 +2,10 @@
float3 position,
float2 texcoord,
column_major uniform float4x4 wvp,
uniform int fog_mode,
uniform int clip_plane0, // In the future this can turn into an array to support other planes
uniform float4 clip_plane0_eq, // In the future this can turn into an array to support other planes
uniform float4x4 modelview,
uniform float fog_near,
uniform float fog_far,
uniform float fog_density,
float4 out vPosition : POSITION,
float out vFog : FOG,
float2 out vTexcoord : TEXCOORD0,
float out vClip : CLP0)
{
@ -25,20 +20,5 @@
}
vPosition = mul(pos4, wvp);
if (fog_mode > 2){ // Fogging disabled
vFog = 1.0f;
}else{
float dist = length(vPosition.xyz);
if (fog_mode == 0){ // GL_LINEAR
vFog = (fog_far - dist) / (fog_far - fog_near);
}else if (fog_mode == 1){ // GL_EXP
vFog = exp(-fog_density * dist);
}else{ // GL_EXP2
const float LOG2 = -1.442695;
float d = fog_density * dist;
vFog = exp(d * d * LOG2);
}
vFog = clamp(vFog, 0.0, 1.0);
}
vTexcoord = texcoord;
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* custom_shaders.c:
* Implementation for custom shaders feature
@ -107,7 +125,7 @@ void _vglDrawObjects_CustomShadersIMPL(GLenum mode, GLsizei count, GLboolean imp
GLuint glCreateShader(GLenum shaderType) {
// Looking for a free shader slot
GLuint i, res = 0;
for (i = 1; i <= MAX_CUSTOM_SHADERS; i++) {
for (i = 1; i < MAX_CUSTOM_SHADERS; i++) {
if (!(shaders[i - 1].valid)) {
res = i;
break;
@ -127,7 +145,7 @@ GLuint glCreateShader(GLenum shaderType) {
shaders[res - 1].type = GL_VERTEX_SHADER;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
shaders[res - 1].valid = GL_TRUE;
@ -176,13 +194,13 @@ void glAttachShader(GLuint prog, GLuint shad) {
break;
}
} else
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
}
GLuint glCreateProgram(void) {
// Looking for a free program slot
GLuint i, res = 0;
for (i = 1; i <= (MAX_CUSTOM_SHADERS / 2); i++) {
for (i = 1; i < (MAX_CUSTOM_SHADERS / 2); i++) {
// Program slot found, reserving and initializing it
if (!(progs[i - 1].valid)) {
res = i;
@ -365,7 +383,7 @@ void vglBindAttribLocation(GLuint prog, GLuint index, const GLchar *name, const
bpe = sizeof(uint8_t);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
@ -383,7 +401,7 @@ void vglVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean nor
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (stride < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -398,7 +416,7 @@ void vglVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean nor
bpe = sizeof(GLshort);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* framebuffers.c:
* Implementation for framebuffers related functions
@ -32,7 +50,7 @@ uint32_t get_color_from_texture(uint32_t type) {
res = SCE_GXM_COLOR_FORMAT_U8_A;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
return res;
@ -48,7 +66,7 @@ void glGenFramebuffers(GLsizei n, GLuint *ids) {
int i = 0, j = 0;
#ifndef SKIP_ERROR_HANDLING
if (n < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -67,7 +85,7 @@ void glGenFramebuffers(GLsizei n, GLuint *ids) {
void glDeleteFramebuffers(GLsizei n, GLuint *framebuffers) {
#ifndef SKIP_ERROR_HANDLING
if (n < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -79,8 +97,8 @@ void glDeleteFramebuffers(GLsizei n, GLuint *framebuffers) {
fb->target = NULL;
}
if (fb->depth_buffer_addr) {
vitagl_mempool_free(fb->depth_buffer_addr, fb->depth_buffer_mem_type);
vitagl_mempool_free(fb->stencil_buffer_addr, fb->stencil_buffer_mem_type);
mempool_free(fb->depth_buffer_addr, fb->depth_buffer_mem_type);
mempool_free(fb->stencil_buffer_addr, fb->stencil_buffer_mem_type);
fb->depth_buffer_addr = NULL;
fb->stencil_buffer_addr = NULL;
}
@ -99,7 +117,7 @@ void glBindFramebuffer(GLenum target, GLuint fb) {
active_write_fb = active_read_fb = (framebuffer *)fb;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -116,7 +134,7 @@ void glFramebufferTexture(GLenum target, GLenum attachment, GLuint tex_id, GLint
fb = active_read_fb;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
@ -160,7 +178,7 @@ void glFramebufferTexture(GLenum target, GLenum attachment, GLuint tex_id, GLint
sceGxmCreateRenderTarget(&renderTargetParams, &fb->target);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* get_info.c:
* Implementation for functions returning info to end user
@ -32,7 +50,7 @@ const GLubyte *glGetString(GLenum name) {
return extensions;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
return NULL;
break;
}
@ -62,12 +80,13 @@ void glGetBooleanv(GLenum pname, GLboolean *params) {
*params = GL_FALSE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
void glGetFloatv(GLenum pname, GLfloat *data) {
int i, j;
switch (pname) {
case GL_POLYGON_OFFSET_FACTOR: // Polygon offset factor
*data = pol_factor;
@ -76,7 +95,20 @@ void glGetFloatv(GLenum pname, GLfloat *data) {
*data = pol_units;
break;
case GL_MODELVIEW_MATRIX: // Modelview matrix
memcpy(data, &modelview_matrix, sizeof(matrix4x4));
// Since we use column-major matrices internally, wee need to transpose it before returning it to the application
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
data[i*4+j] = modelview_matrix[j][i];
}
}
break;
case GL_PROJECTION_MATRIX: // Projection matrix
// Since we use column-major matrices internally, wee need to transpose it before returning it to the application
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
data[i*4+j] = projection_matrix[j][i];
}
}
break;
case GL_ACTIVE_TEXTURE: // Active texture
*data = (1.0f * (server_texture_unit + GL_TEXTURE0));
@ -91,7 +123,7 @@ void glGetFloatv(GLenum pname, GLfloat *data) {
*data = GENERIC_STACK_DEPTH;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -124,7 +156,7 @@ void glGetIntegerv(GLenum pname, GLint *data) {
data[3] = gl_viewport.h;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -157,14 +189,14 @@ GLboolean glIsEnabled(GLenum cap) {
ret = pol_offset_point;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
return ret;
}
GLenum glGetError(void) {
GLenum ret = _vitagl_error;
_vitagl_error = GL_NO_ERROR;
GLenum ret = error;
error = GL_NO_ERROR;
return ret;
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* gxm.c:
* Implementation for setup and cleanup for sceGxm specific stuffs
@ -27,7 +45,7 @@ static void *gxm_stencil_surface_addr; // Stencil surface memblock starting addr
static SceGxmDepthStencilSurface gxm_depth_stencil_surface; // Depth/Stencil surfaces setup for sceGxm
SceGxmContext *gxm_context; // sceGxm context instance
GLenum _vitagl_error = GL_NO_ERROR; // Error returned by glGetError
GLenum error = GL_NO_ERROR; // Error returned by glGetError
SceGxmShaderPatcher *gxm_shader_patcher; // sceGxmShaderPatcher shader patcher instance
matrix4x4 mvp_matrix; // ModelViewProjection Matrix
@ -52,7 +70,7 @@ static void *shader_patcher_host_alloc_cb(void *user_data, unsigned int size) {
// sceGxmShaderPatcher custom deallocator
static void shader_patcher_host_free_cb(void *user_data, void *mem) {
return free(mem);
free(mem);
}
// sceDisplay callback
@ -128,9 +146,9 @@ void initGxmContext(void) {
void termGxmContext(void) {
// Deallocating ring buffers
vitagl_mempool_free(vdm_ring_buffer_addr, VGL_MEM_VRAM);
vitagl_mempool_free(vertex_ring_buffer_addr, VGL_MEM_VRAM);
vitagl_mempool_free(fragment_ring_buffer_addr, VGL_MEM_VRAM);
mempool_free(vdm_ring_buffer_addr, VGL_MEM_VRAM);
mempool_free(vertex_ring_buffer_addr, VGL_MEM_VRAM);
mempool_free(fragment_ring_buffer_addr, VGL_MEM_VRAM);
gpu_fragment_usse_free_mapped(fragment_usse_ring_buffer_addr);
// Destroying sceGxm context
@ -188,7 +206,7 @@ void termDisplayColorSurfaces(void) {
// Deallocating display's color surfaces and destroying sync objects
int i;
for (i = 0; i < DISPLAY_BUFFER_COUNT; i++) {
vitagl_mempool_free(gxm_color_surfaces_addr[i], VGL_MEM_VRAM);
mempool_free(gxm_color_surfaces_addr[i], VGL_MEM_VRAM);
sceGxmSyncObjectDestroy(gxm_sync_objects[i]);
}
}
@ -214,7 +232,7 @@ void initDepthStencilBuffer(uint32_t w, uint32_t h, SceGxmDepthStencilSurface *s
// Initializing depth and stencil surfaces
sceGxmDepthStencilSurfaceInit(surface,
SCE_GXM_DEPTH_STENCIL_FORMAT_DF32M_S8,
SCE_GXM_DEPTH_STENCIL_SURFACE_TILED,
SCE_GXM_DEPTH_STENCIL_SURFACE_LINEAR,
msaa_mode == SCE_GXM_MULTISAMPLE_4X ? depth_stencil_width * 2 : depth_stencil_width,
*depth_buffer,
*stencil_buffer);
@ -227,8 +245,8 @@ void initDepthStencilSurfaces(void) {
void termDepthStencilSurfaces(void) {
// Deallocating depth and stencil surfaces memblocks
vitagl_mempool_free(gxm_depth_surface_addr, VGL_MEM_VRAM);
vitagl_mempool_free(gxm_stencil_surface_addr, VGL_MEM_VRAM);
mempool_free(gxm_depth_surface_addr, VGL_MEM_VRAM);
mempool_free(gxm_stencil_surface_addr, VGL_MEM_VRAM);
}
void startShaderPatcher(void) {
@ -282,7 +300,7 @@ void stopShaderPatcher(void) {
sceGxmShaderPatcherDestroy(gxm_shader_patcher);
// Freeing shader patcher buffers
vitagl_mempool_free(gxm_shader_patcher_buffer_addr, VGL_MEM_VRAM);
mempool_free(gxm_shader_patcher_buffer_addr, VGL_MEM_VRAM);
gpu_vertex_usse_free_mapped(gxm_shader_patcher_vertex_usse_addr);
gpu_fragment_usse_free_mapped(gxm_shader_patcher_fragment_usse_addr);
}
@ -319,14 +337,12 @@ void vglStartRendering(void) {
}
// Setting back current viewport if enabled cause sceGxm will reset it at sceGxmEndScene call
if (scissor_test_state) {
if (viewport_mode)
sceGxmSetViewport(gxm_context, x_port, x_scale, y_port, y_scale, z_port, z_scale);
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, region.x, region.y, region.x + region.w, region.y + region.h);
} else if (viewport_mode) {
sceGxmSetViewport(gxm_context, x_port, x_scale, y_port, y_scale, z_port, z_scale);
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, gl_viewport.x, DISPLAY_HEIGHT - gl_viewport.y - gl_viewport.h, gl_viewport.x + gl_viewport.w, gl_viewport.y + gl_viewport.h);
}
sceGxmSetViewport(gxm_context, x_port, x_scale, y_port, y_scale, z_port, z_scale);
if (scissor_test_state)
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, region.x, region.y, region.x + region.w - 1, region.y + region.h - 1);
else
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, 0, 0, DISPLAY_WIDTH - 1, DISPLAY_HEIGHT - 1);
}
void vglStopRenderingInit(void) {
@ -335,9 +351,6 @@ void vglStopRenderingInit(void) {
}
void vglStopRenderingTerm(void) {
// Waiting GPU to complete its work
sceGxmFinish(gxm_context);
if (active_write_fb == NULL) { // Default framebuffer is used
// Properly requesting a display update

View File

@ -1,3 +1,50 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Copyright (c) 2016, 2017, 2018 vitasdk
* All rights reserved.
*
* 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.
* 3. Neither the name of the copyright holder 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 COPYRIGHT HOLDERS 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 COPYRIGHT
* HOLDER 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.
*/
#include <errno.h>
#include <reent.h>
#include <vitasdk.h>

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* legacy.c:
* Implementation for legacy openGL 1.0 rendering method
@ -69,7 +87,7 @@ void glVertex3f(GLfloat x, GLfloat y, GLfloat z) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase != MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -100,7 +118,7 @@ void glVertex3fv(const GLfloat *v) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase != MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -191,7 +209,7 @@ void glTexCoord2fv(GLfloat *f) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase != MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -214,7 +232,7 @@ void glTexCoord2f(GLfloat s, GLfloat t) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase != MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -237,7 +255,7 @@ void glTexCoord2i(GLint s, GLint t) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase != MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -260,14 +278,13 @@ void glArrayElement(GLint i) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (i < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
// Aliasing client texture unit and client texture id for better code readability
// Aliasing client texture unit for better code readability
texture_unit *tex_unit = &texture_units[client_texture_unit];
int texture2d_idx = tex_unit->tex_id;
// Checking if current texture unit has GL_VERTEX_ARRAY enabled
if (tex_unit->vertex_array_state) {
@ -340,7 +357,7 @@ void glBegin(GLenum mode) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -377,7 +394,7 @@ void glBegin(GLenum mode) {
np = 4;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
@ -393,7 +410,7 @@ void glEnd(void) {
// Error handling
if (phase != MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -437,6 +454,9 @@ void glEnd(void) {
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_mode, 0, 1, &fogmode);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_color, 0, 4, &fog_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_tex_env_color, 0, 4, &texenv_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_density, 0, 1, (const float *)&fog_density);
} else {
// Setting proper vertex and fragment programs
@ -455,15 +475,10 @@ void glEnd(void) {
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_wvp, 0, 16, (const float *)mvp_matrix);
// Setting fogging uniforms
float fogmode = (float)internal_fog_mode;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_mode2, 0, 1, (const float *)&fogmode);
float clipplane0 = (float)clip_plane0;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0, 0, 1, &clipplane0);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0_eq, 0, 4, &clip_plane0_eq.x);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_mv, 0, 16, (const float *)modelview_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_density, 0, 1, (const float *)&fog_density);
// Setting in use texture
sceGxmSetFragmentTexture(gxm_context, 0, &tex_unit->textures[texture2d_idx].gxm_tex);

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* matrices.c:
* Implementation for matrices related functions
@ -28,7 +46,7 @@ void glMatrixMode(GLenum mode) {
matrix = &projection_matrix;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -37,10 +55,10 @@ void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdou
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
} else if ((left == right) || (bottom == top) || (nearVal == farVal)) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -54,10 +72,10 @@ void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLd
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
} else if ((left == right) || (bottom == top) || (nearVal < 0) || (farVal < 0)) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -75,42 +93,33 @@ void glLoadIdentity(void) {
void glMultMatrixf(const GLfloat *m) {
matrix4x4 res;
#ifdef TRANSPOSE_MATRICES
// Properly ordering matrix to perform multiplication
matrix4x4 tmp;
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
tmp[i][j] = m[j * 4 + i];
}
}
// Multiplicating passed matrix with in use one
matrix4x4_multiply(res, *matrix, tmp);
#else
// Multiplicating passed matrix with in use one
matrix4x4_multiply(res, *matrix, m);
#endif
// Copying result to in use matrix
matrix4x4_copy(*matrix, res);
mvp_modified = GL_TRUE;
}
void glLoadMatrixf(const GLfloat *m) {
#ifdef TRANSPOSE_MATRICES
// Properly ordering matrix
matrix4x4 tmp;
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
(*matrix)[i][j] = m[j * 4 + i];
}
}
#else
memcpy(*matrix, m, sizeof(matrix4x4));
#endif
mvp_modified = GL_TRUE;
}
@ -130,7 +139,7 @@ void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -153,7 +162,7 @@ void glPushMatrix(void) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -162,7 +171,7 @@ void glPushMatrix(void) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (modelview_stack_counter >= MODELVIEW_STACK_DEPTH) {
_vitagl_error = GL_STACK_OVERFLOW;
error = GL_STACK_OVERFLOW;
} else
#endif
// Copying current matrix into the matrix stack and increasing stack counter
@ -172,7 +181,7 @@ void glPushMatrix(void) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (projection_stack_counter >= GENERIC_STACK_DEPTH) {
_vitagl_error = GL_STACK_OVERFLOW;
error = GL_STACK_OVERFLOW;
} else
#endif
// Copying current matrix into the matrix stack and increasing stack counter
@ -184,7 +193,7 @@ void glPopMatrix(void) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -193,7 +202,7 @@ void glPopMatrix(void) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (modelview_stack_counter == 0)
_vitagl_error = GL_STACK_UNDERFLOW;
error = GL_STACK_UNDERFLOW;
else
#endif
// Copying last matrix on stack into current matrix and decreasing stack counter
@ -203,7 +212,7 @@ void glPopMatrix(void) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (projection_stack_counter == 0)
_vitagl_error = GL_STACK_UNDERFLOW;
error = GL_STACK_UNDERFLOW;
else
#endif
// Copying last matrix on stack into current matrix and decreasing stack counter

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* misc.c:
* Implementation for miscellaneous functions
@ -101,7 +119,7 @@ void glPolygonMode(GLenum face, GLenum mode) {
new_mode = SCE_GXM_POLYGON_MODE_TRIANGLE_FILL;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
switch (face) {
@ -122,7 +140,7 @@ void glPolygonMode(GLenum face, GLenum mode) {
sceGxmSetBackPolygonMode(gxm_context, new_mode);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
return;
}
update_polygon_offset();
@ -149,7 +167,7 @@ void glFrontFace(GLenum mode) {
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
#ifndef SKIP_ERROR_HANDLING
if ((width < 0) || (height < 0)) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -162,27 +180,24 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
gl_viewport.y = y;
gl_viewport.w = width;
gl_viewport.h = height;
viewport_mode = 1;
}
void glDepthRange(GLdouble nearVal, GLdouble farVal) {
z_port = (farVal + nearVal) / 2.0f;
z_scale = (farVal - nearVal) / 2.0f;
sceGxmSetViewport(gxm_context, x_port, x_scale, y_port, y_scale, z_port, z_scale);
viewport_mode = 1;
}
void glDepthRangef(GLfloat nearVal, GLfloat farVal) {
z_port = (farVal + nearVal) / 2.0f;
z_scale = (farVal - nearVal) / 2.0f;
sceGxmSetViewport(gxm_context, x_port, x_scale, y_port, y_scale, z_port, z_scale);
viewport_mode = 1;
}
void glEnable(GLenum cap) {
#ifndef SKIP_ERROR_HANDLING
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -235,7 +250,7 @@ void glEnable(GLenum cap) {
clip_plane0 = GL_TRUE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -243,7 +258,7 @@ void glEnable(GLenum cap) {
void glDisable(GLenum cap) {
#ifndef SKIP_ERROR_HANDLING
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
@ -296,7 +311,7 @@ void glDisable(GLenum cap) {
clip_plane0 = GL_FALSE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -310,13 +325,14 @@ void glClear(GLbitfield mask) {
sceGxmSetBackPolygonMode(gxm_context, SCE_GXM_POLYGON_MODE_TRIANGLE_FILL);
sceGxmSetVertexProgram(gxm_context, clear_vertex_program_patched);
sceGxmSetFragmentProgram(gxm_context, clear_fragment_program_patched);
void *color_buffer;
void *color_buffer, *vertex_buffer;
sceGxmReserveFragmentDefaultUniformBuffer(gxm_context, &color_buffer);
sceGxmSetUniformDataF(color_buffer, clear_color, 0, 4, &clear_rgba_val.r);
sceGxmSetVertexStream(gxm_context, 0, clear_vertices);
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_buffer);
sceGxmSetUniformDataF(vertex_buffer, clear_position, 0, 4, &clear_vertices->x);
sceGxmDraw(gxm_context, SCE_GXM_PRIMITIVE_TRIANGLE_FAN, SCE_GXM_INDEX_FORMAT_U16, depth_clear_indices, 4);
validate_depth_test();
change_depth_write((depth_mask_state && orig_depth_test) ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
change_depth_write(depth_mask_state ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
sceGxmSetFrontPolygonMode(gxm_context, polygon_mode_front);
sceGxmSetBackPolygonMode(gxm_context, polygon_mode_back);
}
@ -325,14 +341,15 @@ void glClear(GLbitfield mask) {
change_depth_write(SCE_GXM_DEPTH_WRITE_ENABLED);
sceGxmSetVertexProgram(gxm_context, clear_vertex_program_patched);
sceGxmSetFragmentProgram(gxm_context, disable_color_buffer_fragment_program_patched);
void *depth_buffer;
void *depth_buffer, *vertex_buffer;
sceGxmReserveFragmentDefaultUniformBuffer(gxm_context, &depth_buffer);
float temp = depth_value;
sceGxmSetUniformDataF(depth_buffer, clear_depth, 0, 1, &temp);
sceGxmSetVertexStream(gxm_context, 0, clear_vertices);
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_buffer);
sceGxmSetUniformDataF(vertex_buffer, clear_position, 0, 4, &clear_vertices->x);
sceGxmDraw(gxm_context, SCE_GXM_PRIMITIVE_TRIANGLE_FAN, SCE_GXM_INDEX_FORMAT_U16, depth_clear_indices, 4);
validate_depth_test();
change_depth_write((depth_mask_state && orig_depth_test) ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
change_depth_write(depth_mask_state ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
}
if ((mask & GL_STENCIL_BUFFER_BIT) == GL_STENCIL_BUFFER_BIT) {
invalidate_depth_test();
@ -351,14 +368,15 @@ void glClear(GLbitfield mask) {
SCE_GXM_STENCIL_OP_REPLACE,
SCE_GXM_STENCIL_OP_REPLACE,
0, stencil_value * 0xFF);
void *depth_buffer;
void *depth_buffer, *vertex_buffer;
sceGxmReserveFragmentDefaultUniformBuffer(gxm_context, &depth_buffer);
float temp = 1.0f;
sceGxmSetUniformDataF(depth_buffer, clear_depth, 0, 1, &temp);
sceGxmSetVertexStream(gxm_context, 0, clear_vertices);
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_buffer);
sceGxmSetUniformDataF(vertex_buffer, clear_position, 0, 4, &clear_vertices->x);
sceGxmDraw(gxm_context, SCE_GXM_PRIMITIVE_TRIANGLE_FAN, SCE_GXM_INDEX_FORMAT_U16, depth_clear_indices, 4);
validate_depth_test();
change_depth_write((depth_mask_state && orig_depth_test) ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
change_depth_write(depth_mask_state ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
change_stencil_settings();
}
}
@ -393,7 +411,7 @@ void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
@ -411,12 +429,12 @@ void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -425,7 +443,7 @@ void glLineWidth(GLfloat width) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (width <= 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -439,7 +457,7 @@ void glPointSize(GLfloat size) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (size <= 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -465,7 +483,7 @@ void glFogf(GLenum pname, GLfloat param) {
fog_far = param;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -489,7 +507,7 @@ void glFogfv(GLenum pname, const GLfloat *params) {
memcpy(&fog_color.r, params, sizeof(vector4f));
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -510,7 +528,7 @@ void glFogi(GLenum pname, const GLint param) {
fog_far = param;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -530,7 +548,7 @@ void glClipPlane(GLenum plane, const GLdouble *equation) {
memcpy(&clip_plane0_eq.x, &temp.x, sizeof(vector4f));
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
*shaders.h:
*Header file for default shaders related stuffs
@ -51,7 +69,6 @@ const SceGxmProgramParameter *texture2d_clip_plane0;
const SceGxmProgramParameter *texture2d_clip_plane0_eq;
const SceGxmProgramParameter *texture2d_mv;
const SceGxmProgramParameter *texture2d_fog_mode;
const SceGxmProgramParameter *texture2d_fog_mode2;
const SceGxmProgramParameter *texture2d_fog_near;
const SceGxmProgramParameter *texture2d_fog_far;
const SceGxmProgramParameter *texture2d_fog_density;
@ -75,7 +92,6 @@ const SceGxmProgramParameter *texture2d_rgba_clip_plane0;
const SceGxmProgramParameter *texture2d_rgba_clip_plane0_eq;
const SceGxmProgramParameter *texture2d_rgba_mv;
const SceGxmProgramParameter *texture2d_rgba_fog_mode;
const SceGxmProgramParameter *texture2d_rgba_fog_mode2;
const SceGxmProgramParameter *texture2d_rgba_fog_near;
const SceGxmProgramParameter *texture2d_rgba_fog_far;
const SceGxmProgramParameter *texture2d_rgba_fog_density;

View File

@ -1,23 +1,23 @@
#ifndef __clear_f__
#define __clear_f__
static unsigned int size_clear_f = 240;
static unsigned int size_clear_f = 236;
static unsigned char clear_f[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xd2, 0x36, 0xf6, 0xf2,
0x44, 0xaa, 0x22, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0xea, 0x00, 0x00, 0x00, 0x31, 0xc7, 0xbe, 0x93,
0x4c, 0xc3, 0x26, 0xba, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00,
0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00,
0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x80, 0x19, 0xa0,
0x7e, 0x0d, 0x84, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa,
0x00, 0x00, 0x00, 0xc5, 0x22, 0x04, 0x80, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x10, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x75, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x02, 0x80, 0x19, 0xf0,
0x7e, 0x0d, 0x80, 0x40, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x63, 0x6c,
0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00,
};
#endif

View File

@ -1,25 +1,32 @@
#ifndef __clear_v__
#define __clear_v__
static unsigned int size_clear_v = 264;
static unsigned int size_clear_v = 372;
static unsigned char clear_v[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x5b, 0x80, 0x2c, 0x29,
0x17, 0xc6, 0xc1, 0x92, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x01, 0x00, 0x24, 0x9f,
0x88, 0x1f, 0xc5, 0x08, 0x00, 0x0f, 0x00, 0x03, 0x21, 0x05, 0x80, 0x38, 0x00, 0x0f, 0x04, 0x03,
0x59, 0x05, 0x80, 0x38, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb, 0x10, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0x71, 0x01, 0x00, 0x00, 0xf3, 0x7d, 0x64, 0x50,
0xb9, 0x22, 0xc8, 0x0c, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x01, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0d, 0x00, 0x00, 0x00,
0x88, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x03, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x81,
0x0a, 0x05, 0x84, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa,
0x04, 0xc0, 0x07, 0xb0, 0x85, 0x01, 0x88, 0x48, 0x06, 0xc0, 0x07, 0xb0, 0x81, 0x01, 0x88, 0x48,
0x04, 0xc0, 0x07, 0xb0, 0x81, 0x01, 0x88, 0x4d, 0x00, 0x04, 0x40, 0xe0, 0x09, 0x00, 0x81, 0x50,
0x40, 0x00, 0x04, 0xc1, 0x01, 0x05, 0x80, 0x3d, 0x05, 0xc0, 0x07, 0xb0, 0x85, 0x01, 0x88, 0x4e,
0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x81, 0x50, 0x00, 0x00, 0x00, 0xc1, 0x09, 0x05, 0x80, 0x3a,
0x40, 0x00, 0x00, 0x42, 0x01, 0x05, 0x80, 0x38, 0x01, 0x00, 0x04, 0x50, 0x85, 0x11, 0xa5, 0x08,
0x01, 0x80, 0x56, 0x90, 0x81, 0x11, 0x83, 0x08, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x13, 0x00, 0x00, 0x00, 0x04, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x00, 0x00, 0x00, 0x00,
};
#endif

View File

@ -1,25 +1,26 @@
#ifndef __disable_color_buffer_f__
#define __disable_color_buffer_f__
static unsigned int size_disable_color_buffer_f = 272;
static unsigned int size_disable_color_buffer_f = 276;
static unsigned char disable_color_buffer_f[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0xf4, 0x51, 0x72, 0xac,
0x53, 0xb5, 0x21, 0x1b, 0x15, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0x14, 0x01, 0x00, 0x00, 0x4d, 0x94, 0xc7, 0x39,
0x5b, 0xce, 0x5e, 0x9b, 0x15, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00,
0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x44, 0xfa, 0x00, 0x00, 0x00, 0xe0,
0x08, 0x00, 0x81, 0x50, 0x02, 0x01, 0x00, 0xf0, 0x00, 0x00, 0x30, 0xfb, 0x00, 0x00, 0x00, 0x00,
0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x13, 0x00, 0x00, 0x00,
0x02, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x70, 0x74, 0x68, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x44, 0xfa,
0x00, 0x00, 0x00, 0xe0, 0x08, 0x00, 0x81, 0x50, 0x02, 0x01, 0x00, 0xf0, 0x00, 0x00, 0x30, 0xfb,
0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x70, 0x74, 0x68, 0x5f, 0x63, 0x6c,
0x65, 0x61, 0x72, 0x00,
};
#endif

View File

@ -1,29 +1,36 @@
#ifndef __rgb_v__
#define __rgb_v__
static unsigned int size_rgb_v = 332;
static unsigned int size_rgb_v = 448;
static unsigned char rgb_v[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00, 0xbc, 0xb8, 0x59, 0x66,
0x33, 0x69, 0xbf, 0xbb, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0xbd, 0x01, 0x00, 0x00, 0xcf, 0x61, 0x92, 0x9a,
0x71, 0x82, 0x84, 0xfc, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x50, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x08, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x00, 0x00,
0xe0, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x44, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0xaf,
0x9c, 0x0d, 0x80, 0x40, 0x00, 0xa2, 0x3d, 0xc0, 0x81, 0x38, 0x90, 0x18, 0x81, 0x00, 0x04, 0x9f,
0x84, 0x1f, 0xc5, 0x08, 0x00, 0x0f, 0x08, 0x03, 0x21, 0x05, 0x80, 0x38, 0x00, 0x0f, 0x0c, 0x03,
0x59, 0x05, 0x80, 0x38, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x61, 0x43,
0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x77, 0x76, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xa2,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x00, 0x2c, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x05, 0x00, 0xa3,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x01, 0x30, 0x82, 0x02, 0x05, 0x80, 0x38, 0x07, 0x01, 0x43, 0xa2,
0x8e, 0x0d, 0x80, 0x40, 0x0f, 0x05, 0x83, 0xa2, 0x8e, 0x0d, 0x80, 0x40, 0x05, 0x00, 0xc3, 0xa1,
0x8e, 0x0d, 0x80, 0x40, 0x0d, 0x04, 0x03, 0xa2, 0x8e, 0x0d, 0x80, 0x40, 0x00, 0x00, 0x40, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x00, 0x04, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x04, 0x00, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x01, 0x00, 0x82, 0x02, 0x05, 0x84, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x81, 0x00, 0x84, 0x90, 0x85, 0x19, 0xa5, 0x08,
0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0xc0, 0x40, 0x14, 0x89, 0xb9, 0xff, 0xbc, 0x0d, 0xc0, 0x40,
0x0b, 0x11, 0x49, 0xcf, 0x80, 0x8f, 0xb1, 0x18, 0x07, 0x11, 0x45, 0xcf, 0x80, 0x8f, 0xb1, 0x18,
0x01, 0x11, 0x01, 0xc0, 0x81, 0x81, 0xb1, 0x18, 0x00, 0xd1, 0x42, 0xc0, 0x81, 0x81, 0xb1, 0x18,
0xc1, 0x00, 0xd4, 0x90, 0x89, 0x11, 0xc1, 0x08, 0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x00, 0x61, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x77, 0x76, 0x70, 0x00, 0x00, 0x00, 0x00,
};
#endif

View File

@ -1,21 +1,22 @@
#ifndef __rgba_f__
#define __rgba_f__
static unsigned int size_rgba_f = 200;
static unsigned int size_rgba_f = 212;
static unsigned char rgba_f[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xb4, 0x45, 0x0f, 0x73,
0x8c, 0x01, 0x37, 0xf7, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0xd4, 0x00, 0x00, 0x00, 0x9c, 0xd6, 0x9b, 0xf7,
0x94, 0x1a, 0xc4, 0x74, 0x01, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00,
0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0xa0, 0xc0, 0x2e,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x0f, 0xa0, 0xd0, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x02, 0x80, 0x19, 0xa0,
0x7e, 0x0d, 0x80, 0x40,
};
#endif

View File

@ -1,28 +1,36 @@
#ifndef __rgba_v__
#define __rgba_v__
static unsigned int size_rgba_v = 308;
static unsigned int size_rgba_v = 440;
static unsigned char rgba_v[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x31, 0x01, 0x00, 0x00, 0x05, 0x21, 0xf7, 0xc8,
0xe0, 0xa4, 0xdd, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0xb5, 0x01, 0x00, 0x00, 0x24, 0xdc, 0x9e, 0xbb,
0xe8, 0xbd, 0x34, 0xb5, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x48, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x08, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00, 0x00,
0xe0, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x44, 0xfa, 0x80, 0x00, 0x08, 0x83, 0x21, 0x1d, 0x80, 0x38, 0x02, 0x80, 0x81, 0xaf,
0x9c, 0x0d, 0x80, 0x40, 0x00, 0xa2, 0x3d, 0xc0, 0x81, 0x30, 0x90, 0x18, 0x00, 0x00, 0x20, 0xa0,
0x00, 0x50, 0x27, 0xfb, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x50, 0x6f, 0x73,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x61, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x77, 0x76, 0x70,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xa2,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x00, 0x2c, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x05, 0x00, 0xa3,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x01, 0x30, 0x82, 0x02, 0x05, 0x80, 0x38, 0x07, 0x01, 0x43, 0xa2,
0x8e, 0x0d, 0x80, 0x40, 0x0f, 0x05, 0x83, 0xa2, 0x8e, 0x0d, 0x80, 0x40, 0x05, 0x00, 0xc3, 0xa1,
0x8e, 0x0d, 0x80, 0x40, 0x0d, 0x04, 0x03, 0xa2, 0x8e, 0x0d, 0x80, 0x40, 0x00, 0x00, 0x40, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x00, 0x04, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x04, 0x00, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x01, 0x00, 0x82, 0x02, 0x05, 0x84, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x80, 0x00, 0x08, 0x83, 0x21, 0x1d, 0x80, 0x38,
0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0xc0, 0x40, 0x14, 0x89, 0xb9, 0xff, 0xbc, 0x0d, 0xc0, 0x40,
0x0b, 0x11, 0x49, 0xcf, 0x80, 0x8f, 0xb1, 0x18, 0x07, 0x11, 0x45, 0xcf, 0x80, 0x8f, 0xb1, 0x18,
0x01, 0x11, 0x01, 0xc0, 0x81, 0x81, 0xb1, 0x18, 0x00, 0xd1, 0x42, 0xc0, 0x81, 0x81, 0xb1, 0x18,
0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2a, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x21, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x61, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x61, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
0x00, 0x77, 0x76, 0x70, 0x00, 0x00, 0x00, 0x00,
};
#endif

View File

@ -1,73 +1,89 @@
#ifndef __texture2d_f__
#define __texture2d_f__
static unsigned int size_texture2d_f = 1032;
static unsigned int size_texture2d_f = 1284;
static unsigned char texture2d_f[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0xae, 0x88, 0x5a, 0x84,
0x11, 0x87, 0x08, 0x77, 0x09, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x05, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x41, 0x00, 0x00, 0x00,
0xac, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0xcc, 0x02, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x0e,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x10, 0x44, 0xa3,
0xa6, 0x41, 0xa4, 0x08, 0x88, 0x10, 0xc4, 0xa1, 0xaa, 0x00, 0xc0, 0x08, 0x00, 0x00, 0x00, 0x00,
0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x44, 0xfa, 0x93, 0x83, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48, 0x03, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xa0, 0x08, 0x30, 0x81, 0x50, 0x1b, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf8, 0x94, 0x83, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x01, 0x00, 0x04, 0xb0,
0x84, 0x41, 0xa4, 0x09, 0x42, 0x00, 0x44, 0xb0, 0x88, 0x41, 0xc0, 0x09, 0x17, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x95, 0x83, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x0f, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x96, 0x83, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x09, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x04, 0x81, 0x99, 0xff,
0xbc, 0x0d, 0xc0, 0x40, 0x00, 0x01, 0x5d, 0x8f, 0x84, 0x8b, 0xa1, 0x18, 0x41, 0x5f, 0x44, 0x1f,
0x84, 0x1b, 0xa5, 0x08, 0x40, 0x6f, 0x04, 0x10, 0x84, 0x09, 0xa5, 0x08, 0x40, 0x6f, 0x4d, 0x10,
0x80, 0x00, 0x81, 0x08, 0x41, 0x80, 0x4d, 0x80, 0x00, 0x81, 0xe1, 0x18, 0x0b, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf8, 0x41, 0x03, 0x00, 0xf0, 0x84, 0x91, 0xa0, 0x00, 0xc2, 0x11, 0x40, 0xf0,
0x84, 0x00, 0x80, 0x00, 0x42, 0x80, 0x64, 0xb0, 0x00, 0x11, 0x84, 0x08, 0x07, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x04, 0x81, 0x81, 0xff,
0x9c, 0x0d, 0xc0, 0x40, 0x41, 0x00, 0x11, 0x8f, 0xc0, 0x8b, 0xb1, 0x18, 0x7c, 0x00, 0x10, 0x80,
0x84, 0x81, 0xa0, 0x00, 0x7c, 0x10, 0x50, 0x80, 0x84, 0x40, 0x80, 0x00, 0x80, 0x00, 0x04, 0xc2,
0x08, 0x05, 0x80, 0x38, 0x18, 0x83, 0x07, 0xf0, 0x81, 0x06, 0x88, 0x48, 0x00, 0x00, 0x0c, 0xa0,
0x85, 0x01, 0x8b, 0x4d, 0x15, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xfd, 0x14, 0x83, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0x30, 0x15, 0xc9, 0x88, 0x49, 0x12, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x15, 0x83, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0x30,
0x95, 0xca, 0x88, 0x49, 0x0f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x16, 0x83, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0x30, 0x95, 0xc2, 0x88, 0x49, 0x0c, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x17, 0x83, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0x30,
0x95, 0xc1, 0x88, 0x49, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x13, 0x83, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0x30, 0x15, 0xc5, 0x88, 0x49, 0x06, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x19, 0x83, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x00, 0x00, 0x0c, 0xa0,
0x85, 0x01, 0x8b, 0x48, 0x00, 0x81, 0x03, 0x50, 0x05, 0x89, 0x8f, 0x4d, 0x40, 0x00, 0x00, 0x01,
0x0a, 0x05, 0x80, 0x38, 0x00, 0x80, 0x03, 0xb0, 0x85, 0x86, 0x88, 0x4a, 0x12, 0x09, 0x00, 0xf0,
0x06, 0x04, 0x30, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x44, 0xfa, 0x17, 0x84, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48, 0x06, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x0c, 0x85, 0x81, 0xff,
0x9c, 0x0d, 0xc0, 0x40, 0x02, 0x00, 0x11, 0x8f, 0xc0, 0x8b, 0xb1, 0x18, 0x3c, 0x20, 0x00, 0x00,
0x84, 0x91, 0x80, 0x00, 0x7c, 0x20, 0x40, 0x00, 0x84, 0x40, 0x80, 0x00, 0x02, 0x80, 0x19, 0x00,
0x7e, 0x0d, 0x80, 0x40, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x13, 0x00, 0x00, 0x00,
0x12, 0x00, 0x08, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x43, 0x75, 0x74, 0x00, 0x61, 0x6c, 0x70,
0x68, 0x61, 0x4f, 0x70, 0x00, 0x74, 0x69, 0x6e, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74,
0x65, 0x78, 0x45, 0x6e, 0x76, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x66,
0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x45, 0x6e, 0x76, 0x43, 0x6f,
0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0x01, 0x05, 0x00, 0x00, 0xa0, 0xad, 0x6e, 0x36,
0x32, 0x6a, 0xc9, 0x2c, 0x09, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x08, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x4d, 0x00, 0x00, 0x00,
0xc0, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x0b, 0x00, 0x00, 0x00, 0xf4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x03, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x2c, 0x03, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0xd9, 0xc0, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x47, 0x10, 0x44, 0xa4, 0xa6, 0x41, 0xa4, 0x08, 0x88, 0x10, 0x04, 0xa4, 0xaa, 0x00, 0xc0, 0x08,
0xcf, 0x00, 0x04, 0xa2, 0xa6, 0x08, 0xa4, 0x08, 0x49, 0x12, 0x04, 0xaf, 0xa4, 0x10, 0xa4, 0x08,
0x02, 0x3e, 0x00, 0x00, 0x02, 0x00, 0x80, 0x30, 0x40, 0x82, 0xe4, 0xa1, 0x82, 0x10, 0x84, 0x08,
0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x44, 0xfa, 0x17, 0x84, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48,
0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x04, 0x02, 0x03, 0xa0, 0x8c, 0x0d, 0x80, 0x40,
0x06, 0x03, 0x43, 0xa0, 0x8c, 0x0d, 0x80, 0x40, 0x1a, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x15, 0x84, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x81, 0x00, 0x04, 0xb0, 0x84, 0x41, 0xa4, 0x08,
0xc2, 0x00, 0x44, 0xb0, 0x88, 0x41, 0xc0, 0x08, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x16, 0x84, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x0f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x18, 0x84, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x04, 0x81, 0x99, 0xff, 0xbc, 0x0d, 0xc0, 0x40,
0x02, 0x01, 0x5d, 0x8f, 0x84, 0x8b, 0xa1, 0x18, 0x41, 0x5f, 0x44, 0x1f, 0x84, 0x1b, 0xa5, 0x08,
0x40, 0x6f, 0x04, 0x10, 0x84, 0x09, 0xa5, 0x08, 0x40, 0x6f, 0x4d, 0x10, 0x80, 0x00, 0x81, 0x08,
0x03, 0x0f, 0x4c, 0x20, 0x00, 0x11, 0x80, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x41, 0x24, 0x00, 0xf0, 0x84, 0x91, 0xa0, 0x00, 0x02, 0x34, 0x40, 0xf0, 0x84, 0x00, 0x80, 0x00,
0x83, 0x00, 0x46, 0xe0, 0x08, 0x11, 0xc0, 0x08, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x80, 0x02, 0x60, 0xe0, 0x08, 0x00, 0xc1, 0x50, 0x04, 0x81, 0x81, 0xff, 0x9c, 0x0d, 0xc0, 0x40,
0x43, 0x00, 0x11, 0x8f, 0xc0, 0x8b, 0xb1, 0x18, 0xbc, 0x30, 0x04, 0x80, 0x84, 0x91, 0x80, 0x00,
0xfc, 0x30, 0x50, 0x80, 0x84, 0x40, 0x80, 0x00, 0x9a, 0x83, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48,
0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x0c, 0xa0, 0x85, 0x01, 0x8b, 0x48,
0x12, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x95, 0x83, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x80, 0x80, 0x03, 0x30, 0x15, 0xc9, 0x88, 0x48, 0x0f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x96, 0x83, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x80, 0x80, 0x03, 0x30, 0x95, 0xca, 0x88, 0x48,
0x0c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x98, 0x83, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x80, 0x80, 0x03, 0x30, 0x95, 0xc2, 0x88, 0x48, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x99, 0x83, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x80, 0x80, 0x03, 0x30, 0x95, 0xc1, 0x88, 0x48,
0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x97, 0x83, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x80, 0x80, 0x03, 0x30, 0x15, 0xc5, 0x88, 0x48, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x9b, 0x83, 0x07, 0xf0, 0x85, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0x30, 0x95, 0xc6, 0x88, 0x4a,
0x14, 0x0a, 0x00, 0xf0, 0x06, 0x04, 0x30, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x99, 0x84, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48,
0x14, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xfd, 0x95, 0x84, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x0b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x96, 0x84, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0xc1, 0x00, 0x00, 0xe0, 0x82, 0x08, 0x80, 0x08,
0x00, 0x00, 0x00, 0xaf, 0x80, 0x08, 0x80, 0x08, 0x4e, 0x80, 0x01, 0xcf, 0x80, 0x80, 0xe1, 0x18,
0x01, 0x3e, 0x00, 0x00, 0x02, 0x06, 0x80, 0x30, 0x05, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x01, 0x02, 0x00, 0xe0, 0x82, 0x00, 0x80, 0x08, 0x01, 0x00, 0x00, 0x80, 0x02, 0x06, 0x80, 0x30,
0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x07, 0x10, 0x10, 0xf0, 0xa6, 0x00, 0x80, 0x00,
0x0e, 0x50, 0x04, 0xb0, 0x86, 0x08, 0xa4, 0x08, 0x00, 0x60, 0x00, 0x9f, 0x80, 0x08, 0xa5, 0x08,
0x0c, 0x85, 0xa1, 0xff, 0x9c, 0x0d, 0xc0, 0x40, 0x3d, 0x11, 0x41, 0x0f, 0xc0, 0x8b, 0xb1, 0x18,
0x00, 0x11, 0x01, 0x00, 0x80, 0x81, 0xb1, 0x18, 0x01, 0x90, 0x40, 0x00, 0x80, 0x80, 0xb1, 0x18,
0x02, 0x80, 0x19, 0x00, 0x7e, 0x0d, 0x80, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x09, 0x00, 0x00, 0x00, 0x26, 0x35, 0x05, 0xc0,
0x0a, 0x00, 0x00, 0x00, 0x3b, 0xaa, 0xb8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x13, 0x00, 0x00, 0x00, 0x14, 0x00, 0x0b, 0x00,
0xd0, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc9, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0xc1, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xbb, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0xb2, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0xab, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0xa4, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0xa0, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
0x99, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x91, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x8d, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x43, 0x75, 0x74, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x4f, 0x70,
0x00, 0x74, 0x69, 0x6e, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x45, 0x6e,
0x76, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x66, 0x6f, 0x67, 0x43, 0x6f,
0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x45, 0x6e, 0x76, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00,
0x66, 0x6f, 0x67, 0x5f, 0x6e, 0x65, 0x61, 0x72, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x66, 0x61, 0x72,
0x00, 0x66, 0x6f, 0x67, 0x5f, 0x64, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x79, 0x00, 0x74, 0x65, 0x78,
0x00, 0x00, 0x00, 0x00,
};
#endif

View File

@ -1,73 +1,91 @@
#ifndef __texture2d_rgba_f__
#define __texture2d_rgba_f__
static unsigned int size_texture2d_rgba_f = 1040;
static unsigned int size_texture2d_rgba_f = 1320;
static unsigned char texture2d_rgba_f[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x0e, 0x04, 0x00, 0x00, 0x3d, 0x43, 0x2b, 0xd5,
0x8b, 0x8f, 0xb3, 0x36, 0x09, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x09, 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x48, 0x00, 0x00, 0x00,
0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xec, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xa9, 0xd0, 0x0c,
0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x0e,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0x27, 0x05, 0x00, 0x00, 0xf0, 0x40, 0x0f, 0xe9,
0x85, 0x99, 0xb7, 0x4d, 0x09, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x1b, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x55, 0x00, 0x00, 0x00,
0xc0, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x0b, 0x00, 0x00, 0x00, 0x34, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x03, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x6c, 0x03, 0x00, 0x00, 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0xa9, 0xd0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x0f, 0xd0, 0xc0, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0d, 0x80, 0x68, 0xa3, 0xa6, 0x08, 0xc0, 0x08, 0xc7, 0x11, 0x04, 0xaf, 0xa4, 0x10, 0xa4, 0x08,
0x02, 0x3e, 0x40, 0x00, 0x02, 0x00, 0x80, 0x30, 0xc2, 0x81, 0xe4, 0xa1, 0x82, 0x10, 0x84, 0x08,
0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x44, 0xfa, 0x93, 0x81, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48,
0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x04, 0x02, 0x03, 0xa0, 0x8c, 0x0d, 0x80, 0x40,
0x06, 0x03, 0x43, 0xa0, 0x8e, 0x0d, 0x80, 0x40, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x91, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x80, 0x00, 0x04, 0xa0, 0x84, 0x41, 0xa4, 0x08,
0xc1, 0x00, 0x04, 0xa1, 0x8a, 0x41, 0xc0, 0x08, 0x1b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x92, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x13, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x94, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x99, 0xaf, 0xbc, 0x0d, 0xc0, 0x40,
0x02, 0x01, 0x5d, 0x8f, 0x84, 0x8b, 0xa1, 0x18, 0x41, 0x5f, 0x44, 0x1f, 0x84, 0x1b, 0xa5, 0x08,
0x40, 0x6f, 0x04, 0x10, 0x84, 0x09, 0xa5, 0x08, 0x40, 0x6f, 0x4d, 0x10, 0x82, 0x00, 0x81, 0x08,
0x03, 0x0f, 0x4c, 0x20, 0x02, 0x11, 0x80, 0x08, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x99, 0xaf, 0xbc, 0x0d, 0xc0, 0x40,
0x06, 0x82, 0xa1, 0xaf, 0x9c, 0x0d, 0xc0, 0x40, 0x05, 0x01, 0x91, 0xdf, 0x80, 0x8b, 0xb1, 0x18,
0x3d, 0x21, 0x11, 0x00, 0xc0, 0x89, 0xb1, 0x18, 0xbd, 0xa0, 0x48, 0x00, 0xc2, 0x80, 0xb1, 0x18,
0x03, 0x0f, 0x4c, 0x20, 0x02, 0x11, 0x80, 0x08, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x06, 0x82, 0x81, 0xaf, 0x9c, 0x0d, 0xc0, 0x40,
0x00, 0x01, 0x1d, 0x8f, 0xc4, 0x8b, 0xa1, 0x18, 0xc0, 0xc0, 0x13, 0xa0, 0x80, 0x81, 0xa0, 0x00,
0xc1, 0xc0, 0x5b, 0xa0, 0x82, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x08, 0x04, 0x43, 0xa0, 0x8e, 0x0d, 0x80, 0x40, 0x16, 0x81, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48,
0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x0c, 0xa0, 0x85, 0x01, 0x8b, 0x48,
0x12, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x11, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x80, 0x80, 0x03, 0xb0, 0x15, 0xc9, 0x88, 0x48, 0x0f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x12, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x80, 0x80, 0x03, 0xb0, 0x95, 0xca, 0x88, 0x48,
0x0c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x14, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x80, 0x80, 0x03, 0xb0, 0x95, 0xc2, 0x88, 0x48, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x15, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48, 0x80, 0x80, 0x03, 0xb0, 0x95, 0xc1, 0x88, 0x48,
0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x13, 0x81, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x80, 0x80, 0x03, 0xb0, 0x15, 0xc5, 0x88, 0x48, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x17, 0x81, 0x07, 0xf0, 0x85, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0xb0, 0x95, 0xc6, 0x88, 0x4a,
0x10, 0x08, 0x00, 0xf0, 0x06, 0x04, 0x30, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x15, 0x82, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48,
0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x03, 0x00, 0x8e, 0x0d, 0x80, 0x40,
0x14, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x11, 0x82, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x0b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x12, 0x82, 0x07, 0xf0, 0x81, 0x01, 0xa8, 0x48,
0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x05, 0x80, 0x24, 0xe0, 0x82, 0x08, 0x84, 0x08,
0x00, 0x00, 0x00, 0xaf, 0x80, 0x08, 0x80, 0x08, 0x4c, 0x80, 0x01, 0xcf, 0x80, 0x80, 0xe1, 0x18,
0x01, 0x3e, 0x00, 0x00, 0x02, 0x06, 0x80, 0x30, 0x05, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8,
0x45, 0x03, 0x00, 0xe0, 0x82, 0x00, 0x80, 0x08, 0x01, 0x00, 0x00, 0x80, 0x02, 0x06, 0x80, 0x30,
0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x87, 0x50, 0x10, 0xf0, 0xa6, 0x00, 0x80, 0x00,
0x0c, 0x50, 0x04, 0xb0, 0x86, 0x08, 0xa4, 0x08, 0x00, 0x60, 0x00, 0x9f, 0x80, 0x08, 0xa5, 0x08,
0x08, 0x83, 0xa1, 0xff, 0x9c, 0x0d, 0xc0, 0x40, 0x3d, 0x11, 0x41, 0x0f, 0xc0, 0x8b, 0xb1, 0x18,
0x00, 0x11, 0x01, 0x00, 0x82, 0x81, 0xb1, 0x18, 0x01, 0x90, 0x40, 0x80, 0x82, 0x80, 0xb1, 0x18,
0x02, 0x80, 0x19, 0xa0, 0x7e, 0x0d, 0x80, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x09, 0x00, 0x00, 0x00, 0x26, 0x35, 0x05, 0xc0,
0x0a, 0x00, 0x00, 0x00, 0x3b, 0xaa, 0xb8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x13, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0b, 0x00,
0xc0, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb9, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xb1, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0xa8, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0xa1, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x9a, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x96, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x8f, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
0x87, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x83, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x44, 0xfa, 0x0d, 0x81, 0x07, 0xf0,
0x81, 0x06, 0xa8, 0x48, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xa0,
0x0a, 0x30, 0x81, 0x50, 0x22, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x0e, 0x81, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x80, 0x00, 0x44, 0xa0, 0x84, 0x41, 0xa4, 0x09, 0xc1, 0x00, 0x04, 0xa0,
0x88, 0x41, 0xc0, 0x09, 0x1b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x0f, 0x81, 0x07, 0xf0,
0x81, 0x01, 0xa8, 0x48, 0x13, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x10, 0x81, 0x07, 0xf0,
0x81, 0x01, 0xa8, 0x48, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00,
0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x99, 0xaf, 0xbc, 0x0d, 0xc0, 0x40, 0x02, 0x01, 0x5d, 0x8f,
0x84, 0x8b, 0xa1, 0x18, 0x41, 0x5f, 0x44, 0x1f, 0x84, 0x1b, 0xa5, 0x08, 0x40, 0x6f, 0x04, 0x10,
0x86, 0x09, 0xa5, 0x08, 0x40, 0x6f, 0x4d, 0x10, 0x82, 0x00, 0x81, 0x08, 0x43, 0x80, 0x4d, 0x80,
0x02, 0x81, 0xe1, 0x18, 0x12, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x99, 0xaf, 0xbc, 0x0d, 0xc0, 0x40, 0x06, 0x82, 0xa1, 0xaf,
0x9c, 0x0d, 0xc0, 0x40, 0x04, 0x01, 0x91, 0xdf, 0x80, 0x8b, 0xb1, 0x18, 0x3d, 0x21, 0x11, 0x00,
0xc2, 0x89, 0xb1, 0x18, 0xbd, 0xa0, 0x48, 0x00, 0xc2, 0x80, 0xb1, 0x18, 0x43, 0x80, 0x4d, 0x80,
0x02, 0x81, 0xe1, 0x18, 0x0a, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x40, 0x09, 0x00, 0xf8, 0x06, 0x82, 0x81, 0xaf, 0x9c, 0x0d, 0xc0, 0x40, 0x00, 0x01, 0x1d, 0x8f,
0xc4, 0x8b, 0xa1, 0x18, 0xc0, 0xc0, 0x13, 0xa0, 0x82, 0x81, 0xa0, 0x00, 0xc1, 0xc0, 0x5b, 0xa0,
0x82, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x01, 0x4e, 0x01, 0x01,
0x02, 0x00, 0x10, 0xfa, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x30, 0x81, 0x50, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x10, 0xfa, 0x92, 0x80, 0x07, 0xf0, 0x81, 0x06, 0x88, 0x48, 0x00, 0x00, 0x0c, 0xa0,
0x85, 0x01, 0x8b, 0x4d, 0x15, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xfd, 0x8e, 0x80, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0xb0, 0x15, 0xc9, 0x88, 0x49, 0x12, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x8f, 0x80, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0xb0,
0x95, 0xca, 0x88, 0x49, 0x0f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x90, 0x80, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0xb0, 0x95, 0xc2, 0x88, 0x49, 0x0c, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x91, 0x80, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0xb0,
0x95, 0xc1, 0x88, 0x49, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x8d, 0x80, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x80, 0x80, 0x03, 0xb0, 0x15, 0xc5, 0x88, 0x49, 0x06, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x93, 0x80, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x00, 0x00, 0x0c, 0xa0,
0x85, 0x01, 0x8b, 0x48, 0x00, 0x81, 0x03, 0x50, 0x05, 0x89, 0x8f, 0x4d, 0x40, 0x00, 0x08, 0x81,
0x0a, 0x05, 0x80, 0x38, 0x00, 0x81, 0x03, 0xb0, 0x85, 0x86, 0x88, 0x4a, 0x0c, 0x06, 0x00, 0xf0,
0x06, 0x04, 0x30, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x44, 0xfa, 0x91, 0x81, 0x07, 0xf0, 0x81, 0x06, 0xa8, 0x48, 0x06, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x06, 0x82, 0x81, 0xff,
0x9c, 0x0d, 0xc0, 0x40, 0x04, 0x00, 0x11, 0x8f, 0xc0, 0x8b, 0xb1, 0x18, 0x3c, 0x40, 0x00, 0x80,
0x86, 0x91, 0x80, 0x00, 0x7c, 0x40, 0x40, 0x80, 0x86, 0x40, 0x80, 0x00, 0x02, 0x80, 0x19, 0xa0,
0x7e, 0x0d, 0x80, 0x40, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x13, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x08, 0x00, 0x70, 0x00, 0x00, 0x00, 0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x43, 0x75, 0x74, 0x00, 0x61, 0x6c, 0x70,
0x68, 0x61, 0x4f, 0x70, 0x00, 0x74, 0x65, 0x78, 0x45, 0x6e, 0x76, 0x00, 0x66, 0x6f, 0x67, 0x5f,
0x6d, 0x6f, 0x64, 0x65, 0x00, 0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65,
0x78, 0x45, 0x6e, 0x76, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x00, 0x00, 0x00,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x43, 0x75, 0x74, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x4f, 0x70,
0x00, 0x74, 0x65, 0x78, 0x45, 0x6e, 0x76, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x45, 0x6e, 0x76,
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x6e, 0x65, 0x61, 0x72, 0x00, 0x66,
0x6f, 0x67, 0x5f, 0x66, 0x61, 0x72, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x64, 0x65, 0x6e, 0x73, 0x69,
0x74, 0x79, 0x00, 0x74, 0x65, 0x78, 0x00, 0x00,
};
#endif

View File

@ -1,65 +1,50 @@
#ifndef __texture2d_rgba_v__
#define __texture2d_rgba_v__
static unsigned int size_texture2d_rgba_v = 900;
static unsigned int size_texture2d_rgba_v = 668;
static unsigned char texture2d_rgba_v[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x83, 0x03, 0x00, 0x00, 0x8f, 0x3b, 0x70, 0x51,
0x7e, 0x76, 0xab, 0xcf, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00,
0xac, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0x37, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1a, 0x00, 0x0d, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x68, 0x41, 0x0a, 0x05, 0x82, 0x38,
0x14, 0x15, 0x04, 0xa5, 0xa6, 0x10, 0xa4, 0x08, 0x02, 0x0a, 0x20, 0x82, 0x02, 0x00, 0x80, 0x30,
0x11, 0x85, 0x68, 0xa6, 0x86, 0x10, 0xc0, 0x08, 0x10, 0x06, 0x04, 0xa5, 0xa6, 0x00, 0xa4, 0x08,
0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x44, 0xfa, 0x01, 0x0e, 0x01, 0x34, 0x0a, 0x00, 0x10, 0xfa, 0x80, 0x00, 0x08, 0x83,
0x21, 0x25, 0x80, 0x38, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x10, 0xfa, 0x2b, 0x91, 0x07, 0xf0,
0x81, 0x06, 0xc8, 0x48, 0x40, 0x05, 0xf0, 0xc1, 0x00, 0x05, 0x80, 0x38, 0x41, 0x92, 0x80, 0x41,
0x81, 0x80, 0xd3, 0x19, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00,
0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0x80, 0x40, 0x08, 0xa2, 0xbd, 0xc0,
0x82, 0x38, 0x90, 0x18, 0x26, 0x92, 0x99, 0xff, 0xbc, 0x0d, 0x80, 0x40, 0x02, 0xa2, 0x91, 0x81,
0x81, 0x80, 0xd1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0xaf,
0x9c, 0x0d, 0x80, 0x40, 0x00, 0xa2, 0x3d, 0xc0, 0x81, 0x30, 0x90, 0x18, 0xac, 0x90, 0x07, 0xf0,
0x81, 0x0a, 0x88, 0x48, 0x80, 0x06, 0x10, 0xc1, 0x01, 0x05, 0x80, 0x39, 0x14, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0x5f,
0x9c, 0x0d, 0x80, 0x40, 0x3c, 0xa2, 0x11, 0x00, 0x82, 0x80, 0x81, 0x18, 0x01, 0x00, 0x00, 0x80,
0x02, 0x02, 0x80, 0x30, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x80, 0x30, 0xad, 0x90, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x59, 0x04, 0x14, 0xf0, 0xa6, 0x00, 0x80, 0x01, 0x0a, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0xab, 0x90, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x06, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x00, 0x04, 0x04, 0xe0, 0x86, 0x10, 0xa4, 0x08, 0x00, 0x00, 0x04, 0xa0,
0x86, 0x00, 0xa4, 0x08, 0x17, 0x00, 0x04, 0xb0, 0x86, 0x10, 0xa4, 0x08, 0x01, 0x00, 0x00, 0x80,
0x02, 0x06, 0x80, 0x30, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x00, 0x05, 0x04, 0xe0,
0x86, 0x10, 0xa4, 0x08, 0x01, 0x00, 0x00, 0x80, 0x02, 0x06, 0x80, 0x30, 0x17, 0x50, 0x04, 0xb0,
0x86, 0x00, 0xa4, 0x08, 0x00, 0x60, 0x04, 0x91, 0x85, 0x00, 0xa5, 0x08, 0x00, 0x00, 0x20, 0xa0,
0x00, 0x50, 0x27, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x05, 0x00, 0x00, 0x00,
0x26, 0x35, 0x05, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x3b, 0xaa, 0xb8, 0x3f, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x2a, 0x00, 0x13, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x07, 0x00, 0xb0, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00,
0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00,
0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00,
0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00,
0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00,
0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x63, 0x6f,
0x6c, 0x6f, 0x72, 0x00, 0x77, 0x76, 0x70, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x30, 0x00, 0x63, 0x6c, 0x69,
0x70, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x30, 0x5f, 0x65, 0x71, 0x00, 0x6d, 0x6f, 0x64, 0x65,
0x6c, 0x76, 0x69, 0x65, 0x77, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x6e, 0x65, 0x61, 0x72, 0x00, 0x66,
0x6f, 0x67, 0x5f, 0x66, 0x61, 0x72, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x64, 0x65, 0x6e, 0x73, 0x69,
0x74, 0x79, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0x99, 0x02, 0x00, 0x00, 0x03, 0x54, 0x4f, 0xaa,
0x6e, 0x7a, 0x89, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x15, 0x00, 0x00, 0x00,
0xe0, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x70, 0x01, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x02, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x01, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x0f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x18, 0x00, 0x0b,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xa6,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x00, 0x60, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x05, 0x40, 0xa6,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x01, 0x64, 0x82, 0x02, 0x05, 0x80, 0x38, 0x07, 0x01, 0x83, 0xa5,
0x8e, 0x0d, 0x80, 0x40, 0x0f, 0x05, 0xc3, 0xa5, 0x8e, 0x0d, 0x80, 0x40, 0x05, 0x00, 0x03, 0xa5,
0x8e, 0x0d, 0x80, 0x40, 0x0d, 0x04, 0x43, 0xa5, 0x8e, 0x0d, 0x80, 0x40, 0x00, 0x00, 0x40, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x00, 0x04, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x04, 0x00, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x01, 0x00, 0x82, 0x02, 0x05, 0x84, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x01, 0x0e, 0x01, 0x01, 0x02, 0x00, 0x10, 0xfa,
0x80, 0x00, 0x08, 0x83, 0x21, 0x25, 0x80, 0x38, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x10, 0xfa,
0x27, 0x90, 0x07, 0xf0, 0x81, 0x06, 0xc8, 0x48, 0xc0, 0x04, 0xf0, 0xc1, 0x00, 0x05, 0x80, 0x38,
0x41, 0x92, 0x40, 0x41, 0x81, 0x80, 0xd3, 0x18, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0x80, 0x40,
0x08, 0xa2, 0xbd, 0xc0, 0x82, 0x38, 0x90, 0x18, 0x24, 0x91, 0x99, 0xff, 0xbc, 0x0d, 0x80, 0x40,
0x02, 0xa2, 0x51, 0x81, 0x81, 0x80, 0xd1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8,
0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0xc0, 0x40, 0x2e, 0x96, 0xb9, 0xff, 0xbc, 0x0d, 0xc0, 0x40,
0x18, 0x11, 0x49, 0xcf, 0x80, 0x8f, 0xb1, 0x18, 0x14, 0x11, 0x45, 0xcf, 0x80, 0x8f, 0xb1, 0x18,
0x01, 0x11, 0x01, 0xc0, 0x81, 0x81, 0xb1, 0x18, 0x00, 0xd1, 0x42, 0xc0, 0x81, 0x81, 0xb1, 0x18,
0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00,
0x13, 0x00, 0x00, 0x00, 0x26, 0x00, 0x02, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00,
0x77, 0x76, 0x70, 0x00, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x30, 0x00,
0x63, 0x6c, 0x69, 0x70, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x30, 0x5f, 0x65, 0x71, 0x00, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x00,
};
#endif

View File

@ -1,62 +1,48 @@
#ifndef __texture2d_v__
#define __texture2d_v__
static unsigned int size_texture2d_v = 864;
static unsigned int size_texture2d_v = 628;
static unsigned char texture2d_v[] __attribute__((aligned(16))) = {
0x47, 0x58, 0x50, 0x00, 0x01, 0x04, 0x00, 0x00, 0x5d, 0x03, 0x00, 0x00, 0x7d, 0xa1, 0xee, 0xec,
0x39, 0xcd, 0x14, 0x0a, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x34, 0x02, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x08, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00,
0xac, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0xe4, 0x01, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x12, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x68, 0x41, 0x0a, 0x05, 0x82, 0x38,
0x14, 0x15, 0x04, 0xa5, 0xa6, 0x10, 0xa4, 0x08, 0x02, 0x0a, 0x20, 0x82, 0x02, 0x00, 0x80, 0x30,
0x11, 0x85, 0x68, 0xa6, 0x86, 0x10, 0xc0, 0x08, 0x10, 0x06, 0x04, 0xa5, 0xa6, 0x00, 0xa4, 0x08,
0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x44, 0xfa, 0x80, 0x00, 0x0c, 0x83, 0x21, 0x05, 0x80, 0x38, 0x2b, 0x91, 0x07, 0xf0,
0x81, 0x06, 0xc8, 0x48, 0x40, 0x05, 0xf0, 0xc1, 0x00, 0x05, 0x80, 0x38, 0x41, 0x92, 0x00, 0x41,
0x81, 0x80, 0xd3, 0x19, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00,
0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0x80, 0x40, 0x08, 0xa2, 0x3d, 0xc0,
0x81, 0x38, 0x90, 0x18, 0x26, 0x92, 0x99, 0xff, 0xbc, 0x0d, 0x80, 0x40, 0x00, 0xa2, 0x11, 0x41,
0x81, 0x80, 0xd1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0xaf,
0x9c, 0x0d, 0x80, 0x40, 0x00, 0xa2, 0x3d, 0xc0, 0x81, 0x30, 0x90, 0x18, 0xac, 0x90, 0x07, 0xf0,
0x81, 0x0a, 0x88, 0x48, 0x80, 0x06, 0x08, 0xc1, 0x01, 0x05, 0x80, 0x39, 0x14, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0x5f,
0x9c, 0x0d, 0x80, 0x40, 0x3c, 0xa2, 0x11, 0x00, 0x82, 0x80, 0x81, 0x18, 0x01, 0x00, 0x00, 0x80,
0x02, 0x02, 0x80, 0x30, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x80, 0x30, 0xad, 0x90, 0x07, 0xf0,
0x81, 0x01, 0x88, 0x48, 0x59, 0x04, 0x14, 0xf0, 0xa6, 0x00, 0x80, 0x01, 0x0a, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0xab, 0x90, 0x07, 0xf0, 0x81, 0x01, 0x88, 0x48, 0x06, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0xf9, 0x00, 0x04, 0x04, 0xe0, 0x86, 0x10, 0xa4, 0x08, 0x00, 0x00, 0x04, 0xa0,
0x86, 0x00, 0xa4, 0x08, 0x17, 0x00, 0x04, 0xb0, 0x86, 0x10, 0xa4, 0x08, 0x01, 0x00, 0x00, 0x80,
0x02, 0x06, 0x80, 0x30, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf8, 0x00, 0x05, 0x04, 0xe0,
0x86, 0x10, 0xa4, 0x08, 0x01, 0x00, 0x00, 0x80, 0x02, 0x06, 0x80, 0x30, 0x17, 0x50, 0x04, 0xb0,
0x86, 0x00, 0xa4, 0x08, 0x00, 0x60, 0x84, 0x90, 0x85, 0x00, 0xa5, 0x08, 0x00, 0x00, 0x20, 0xa0,
0x00, 0x50, 0x27, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x05, 0x00, 0x00, 0x00,
0x26, 0x35, 0x05, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x3b, 0xaa, 0xb8, 0x3f, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x2a, 0x00, 0x13, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x07, 0x00, 0xa0, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00,
0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00,
0x41, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00,
0x01, 0xe4, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00,
0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00,
0x01, 0xe1, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x77, 0x76,
0x70, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x63, 0x6c, 0x69, 0x70, 0x5f,
0x70, 0x6c, 0x61, 0x6e, 0x65, 0x30, 0x00, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x70, 0x6c, 0x61, 0x6e,
0x65, 0x30, 0x5f, 0x65, 0x71, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x76, 0x69, 0x65, 0x77, 0x00,
0x66, 0x6f, 0x67, 0x5f, 0x6e, 0x65, 0x61, 0x72, 0x00, 0x66, 0x6f, 0x67, 0x5f, 0x66, 0x61, 0x72,
0x00, 0x66, 0x6f, 0x67, 0x5f, 0x64, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00,
0x47, 0x58, 0x50, 0x00, 0x01, 0x05, 0x50, 0x03, 0x73, 0x02, 0x00, 0x00, 0xd5, 0xed, 0x20, 0x1e,
0xe4, 0x17, 0x9c, 0x83, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
0x08, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x13, 0x00, 0x00, 0x00,
0xe0, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0xc0, 0x3d, 0x03, 0x00,
0x02, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x07,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xa6,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x00, 0x60, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x05, 0x40, 0xa6,
0x0a, 0x00, 0x81, 0x50, 0xc0, 0x01, 0x64, 0x82, 0x02, 0x05, 0x80, 0x38, 0x07, 0x01, 0x83, 0xa5,
0x8e, 0x0d, 0x80, 0x40, 0x0f, 0x05, 0xc3, 0xa5, 0x8e, 0x0d, 0x80, 0x40, 0x05, 0x00, 0x03, 0xa5,
0x8e, 0x0d, 0x80, 0x40, 0x0d, 0x04, 0x43, 0xa5, 0x8e, 0x0d, 0x80, 0x40, 0x00, 0x00, 0x40, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x00, 0x04, 0x82, 0x02, 0x05, 0x80, 0x38, 0x00, 0x04, 0x00, 0xa0,
0x0a, 0x00, 0x81, 0x50, 0x80, 0x01, 0x00, 0x82, 0x02, 0x05, 0x84, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x44, 0xfa, 0x80, 0x00, 0x08, 0x83, 0x21, 0x05, 0x80, 0x38,
0x27, 0x90, 0x07, 0xf0, 0x81, 0x06, 0xc8, 0x48, 0xc0, 0x04, 0xf0, 0xc1, 0x00, 0x05, 0x80, 0x38,
0x41, 0x92, 0xc0, 0x40, 0x81, 0x80, 0xd3, 0x18, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf9,
0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8, 0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0x80, 0x40,
0x08, 0xa2, 0x3d, 0xc0, 0x81, 0x38, 0x90, 0x18, 0x24, 0x91, 0x99, 0xff, 0xbc, 0x0d, 0x80, 0x40,
0x00, 0xa2, 0xd1, 0x40, 0x81, 0x80, 0xd1, 0x18, 0x00, 0x00, 0x00, 0x00, 0x40, 0x09, 0x00, 0xf8,
0x02, 0x80, 0x81, 0xaf, 0x9c, 0x0d, 0xc0, 0x40, 0x2e, 0x96, 0xb9, 0xff, 0xbc, 0x0d, 0xc0, 0x40,
0x18, 0x11, 0x49, 0xcf, 0x80, 0x8f, 0xb1, 0x18, 0x14, 0x11, 0x45, 0xcf, 0x80, 0x8f, 0xb1, 0x18,
0x01, 0x11, 0x01, 0xc0, 0x81, 0x81, 0xb1, 0x18, 0x00, 0xd1, 0x42, 0xc0, 0x81, 0x81, 0xb1, 0x18,
0x00, 0x00, 0x20, 0xa0, 0x00, 0x50, 0x27, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00,
0x13, 0x00, 0x00, 0x00, 0x26, 0x00, 0x02, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x41, 0xe1, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x01, 0xe4, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x00, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x77, 0x76, 0x70, 0x00, 0x63, 0x6c,
0x69, 0x70, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x30, 0x00, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x70,
0x6c, 0x61, 0x6e, 0x65, 0x30, 0x5f, 0x65, 0x71, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x76, 0x69,
0x65, 0x77, 0x00, 0x00,
};
#endif

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* shared.h:
* All functions/definitions that shouldn't be exposed to
@ -77,6 +95,7 @@ typedef enum SceGxmPrimitiveTypeExtra {
extern void *frag_uniforms;
extern void *vert_uniforms;
extern SceGxmMultisampleMode msaa_mode;
extern GLboolean use_extra_mem;
// Debugging tool
#ifdef ENABLE_LOG
@ -96,8 +115,16 @@ extern float x_scale;
extern float y_scale;
extern float z_scale;
// Fullscreen sceGxm viewport (NOTE: origin is on center screen)
extern float fullscreen_x_port;
extern float fullscreen_y_port;
extern float fullscreen_z_port;
extern float fullscreen_x_scale;
extern float fullscreen_y_scale;
extern float fullscreen_z_scale;
extern SceGxmContext *gxm_context; // sceGxm context instance
extern GLenum _vitagl_error; // Error returned by glGetError
extern GLenum error; // Error returned by glGetError
extern SceGxmShaderPatcher *gxm_shader_patcher; // sceGxmShaderPatcher shader patcher instance
matrix4x4 mvp_matrix; // ModelViewProjection Matrix
@ -106,21 +133,20 @@ matrix4x4 modelview_matrix; // ModelView Matrix
extern GLboolean mvp_modified; // Check if ModelViewProjection matrix needs to be recreated
extern GLuint cur_program; // Current in use custom program (0 = No custom program)
extern uint8_t viewport_mode; // Current setting for viewport mode
extern GLboolean vblank; // Current setting for VSync
extern GLenum orig_depth_test; // Original depth test state (used for depth test invalidation)
// Scissor test shaders
extern SceGxmFragmentProgram *scissor_test_fragment_program; // Scissor test fragment program
extern vector2f *scissor_test_vertices; // Scissor test region vertices
extern vector4f *scissor_test_vertices; // Scissor test region vertices
extern SceUID scissor_test_vertices_uid; // Scissor test vertices memblock id
extern uint16_t *depth_clear_indices; // Memblock starting address for clear screen indices
// Clear screen shaders
extern SceGxmVertexProgram *clear_vertex_program_patched; // Patched vertex program for clearing screen
extern vector2f *clear_vertices; // Memblock starting address for clear screen vertices
extern vector4f *clear_vertices; // Memblock starting address for clear screen vertices
/* gxm.c */
void initGxm(void); // Inits sceGxm
@ -160,6 +186,6 @@ void reloadCustomShader(void); // Reloads in use custom shader inside sceGxm
void _vglDrawObjects_CustomShadersIMPL(GLenum mode, GLsizei count, GLboolean implicit_wvp); // vglDrawObjects implementation for rendering with custom shaders
/* misc functions */
void vector2f_convert_to_local_space(vector2f *out, int x, int y, int width, int height); // Converts screen coords to local space
void vector4f_convert_to_local_space(vector4f *out, int x, int y, int width, int height); // Converts screen coords to local space
#endif

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* state.c:
* Initial config of the openGL machine state

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* state.h:
* Header file managing state of openGL machine

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* tests.c:
* Implementation for all drawing tests functions
@ -16,7 +34,7 @@ GLboolean depth_mask_state = GL_TRUE; // Current state for glDepthMask
scissor_region region; // Current scissor test region setup
GLboolean scissor_test_state = GL_FALSE; // Current state for GL_SCISSOR_TEST
SceGxmFragmentProgram *scissor_test_fragment_program; // Scissor test fragment program
vector2f *scissor_test_vertices = NULL; // Scissor test region vertices
vector4f *scissor_test_vertices = NULL; // Scissor test region vertices
SceUID scissor_test_vertices_uid; // Scissor test vertices memblock id
// Stencil Test
@ -55,7 +73,7 @@ void change_depth_func() {
sceGxmSetBackDepthFunc(gxm_context, depth_test_state ? gxm_depth : SCE_GXM_DEPTH_FUNC_ALWAYS);
// Calling an update for the depth write mode
change_depth_write((depth_mask_state && depth_test_state) ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
change_depth_write(depth_mask_state ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
}
void invalidate_depth_test() {
@ -68,13 +86,23 @@ void invalidate_depth_test() {
}
void validate_depth_test() {
// Resetting original depth test state
// Restoring original depth test state
depth_test_state = orig_depth_test;
// Invoking a depth function update
change_depth_func();
}
void invalidate_viewport() {
// Invalidating current viewport
sceGxmSetViewport(gxm_context, fullscreen_x_port, fullscreen_x_scale, fullscreen_y_port, fullscreen_y_scale, fullscreen_z_port, fullscreen_z_scale);
}
void validate_viewport() {
// Restoring original viewport
sceGxmSetViewport(gxm_context, x_port, x_scale, y_port, y_scale, z_port, z_scale);
}
void change_stencil_settings() {
if (stencil_test_state) {
// Setting stencil function for both front and back primitives
@ -215,30 +243,39 @@ void update_alpha_test_settings() {
}
void update_scissor_test() {
// Calculating scissor test region vertices
if (scissor_test_state) {
vector2f_convert_to_local_space(scissor_test_vertices, region.x, region.y, region.w, region.h);
}
// Setting current vertex program to clear screen one and fragment program to scissor test one
sceGxmSetVertexProgram(gxm_context, clear_vertex_program_patched);
sceGxmSetFragmentProgram(gxm_context, scissor_test_fragment_program);
// Cleaning stencil surface mask update bit on the whole screen
sceGxmSetFrontStencilFunc(gxm_context,
SCE_GXM_STENCIL_FUNC_NEVER,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
0, 0);
sceGxmSetBackStencilFunc(gxm_context,
SCE_GXM_STENCIL_FUNC_NEVER,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
0, 0);
sceGxmSetVertexStream(gxm_context, 0, clear_vertices);
sceGxmDraw(gxm_context, SCE_GXM_PRIMITIVE_TRIANGLE_FAN, SCE_GXM_INDEX_FORMAT_U16, depth_clear_indices, 4);
// Invalidating viewport
invalidate_viewport();
// Invalidating internal tile based region clip
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, 0, 0, DISPLAY_WIDTH - 1, DISPLAY_HEIGHT - 1);
if (scissor_test_state) {
// Calculating scissor test region vertices
vector4f_convert_to_local_space(scissor_test_vertices, region.x, region.y, region.w, region.h);
void *vertex_buffer;
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_buffer);
sceGxmSetUniformDataF(vertex_buffer, clear_position, 0, 4, &clear_vertices->x);
// Cleaning stencil surface mask update bit on the whole screen
sceGxmSetFrontStencilFunc(gxm_context,
SCE_GXM_STENCIL_FUNC_NEVER,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
0, 0);
sceGxmSetBackStencilFunc(gxm_context,
SCE_GXM_STENCIL_FUNC_NEVER,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
0, 0);
sceGxmDraw(gxm_context, SCE_GXM_PRIMITIVE_TRIANGLE_FAN, SCE_GXM_INDEX_FORMAT_U16, depth_clear_indices, 4);
}
// Setting stencil surface mask update bit on the scissor test region
sceGxmSetFrontStencilFunc(gxm_context,
@ -253,16 +290,24 @@ void update_scissor_test() {
SCE_GXM_STENCIL_OP_KEEP,
SCE_GXM_STENCIL_OP_KEEP,
0, 0);
void *vertex_buffer;
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_buffer);
if (scissor_test_state)
sceGxmSetVertexStream(gxm_context, 0, scissor_test_vertices);
sceGxmSetUniformDataF(vertex_buffer, clear_position, 0, 4, &scissor_test_vertices->x);
else
sceGxmSetVertexStream(gxm_context, 0, clear_vertices);
sceGxmSetUniformDataF(vertex_buffer, clear_position, 0, 4, &clear_vertices->x);
sceGxmDraw(gxm_context, SCE_GXM_PRIMITIVE_TRIANGLE_FAN, SCE_GXM_INDEX_FORMAT_U16, depth_clear_indices, 4);
// Restoring viewport
validate_viewport();
// Reducing GPU workload by performing tile granularity clipping
if (scissor_test_state)
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, region.x, region.y, region.x + region.w, region.y + region.h);
else
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, gl_viewport.x, DISPLAY_HEIGHT - gl_viewport.y - gl_viewport.h, gl_viewport.x + gl_viewport.w, gl_viewport.y + gl_viewport.h);
sceGxmSetRegionClip(gxm_context, SCE_GXM_REGION_CLIP_OUTSIDE, region.x, region.y, region.x + region.w - 1, region.y + region.h - 1);
// Restoring original stencil test settings
change_stencil_settings();
}
void resetScissorTestRegion(void) {
@ -282,7 +327,7 @@ void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if ((width < 0) || (height < 0)) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -340,14 +385,14 @@ void glDepthMask(GLboolean flag) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (phase == MODEL_CREATION) {
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
return;
}
#endif
// Set current in use depth mask and invoking a depth write mode update
depth_mask_state = flag;
change_depth_write((depth_mask_state && depth_test_state) ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
change_depth_write(depth_mask_state ? SCE_GXM_DEPTH_WRITE_ENABLED : SCE_GXM_DEPTH_WRITE_DISABLED);
}
void glAlphaFunc(GLenum func, GLfloat ref) {
@ -362,36 +407,36 @@ void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass
switch (face) {
case GL_FRONT:
if (!change_stencil_config(&stencil_fail_front, sfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_fail_front, dpfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_pass_front, dppass))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
case GL_BACK:
if (!change_stencil_config(&stencil_fail_back, sfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_fail_back, dpfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_pass_front, dppass))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
case GL_FRONT_AND_BACK:
if (!change_stencil_config(&stencil_fail_front, sfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&stencil_fail_back, sfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_fail_front, dpfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_fail_back, dpfail))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_pass_front, dppass))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_config(&depth_pass_back, dppass))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
change_stencil_settings();
@ -406,26 +451,26 @@ void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) {
switch (face) {
case GL_FRONT:
if (!change_stencil_func_config(&stencil_func_front, func))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
stencil_mask_front = mask;
stencil_ref_front = ref;
break;
case GL_BACK:
if (!change_stencil_func_config(&stencil_func_back, func))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
stencil_mask_back = mask;
stencil_ref_back = ref;
break;
case GL_FRONT_AND_BACK:
if (!change_stencil_func_config(&stencil_func_front, func))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
if (!change_stencil_func_config(&stencil_func_back, func))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
stencil_mask_front = stencil_mask_back = mask;
stencil_ref_front = stencil_ref_back = ref;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
change_stencil_settings();
@ -448,7 +493,7 @@ void glStencilMaskSeparate(GLenum face, GLuint mask) {
stencil_mask_front_write = stencil_mask_back_write = mask;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
return;
}
change_stencil_settings();

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* texture_callbacks.c:
* Implementation for texture data reading/writing callbacks

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* texture_callbacks.h:
* Header file for texture data reading/writing callbacks exposed by texture_callbacks.c

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* textures.c:
* Implementation for textures related functions
@ -19,7 +37,7 @@ void glGenTextures(GLsizei n, GLuint *res) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (n < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -49,7 +67,7 @@ void glBindTexture(GLenum target, GLuint texture) {
tex_unit->tex_id = texture;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -58,7 +76,7 @@ void glDeleteTextures(GLsizei n, const GLuint *gl_textures) {
#ifndef SKIP_ERROR_HANDLING
// Error handling
if (n < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -119,7 +137,7 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
data_bpp = 1;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
@ -131,7 +149,7 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
data_bpp = 2;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
@ -142,7 +160,7 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
read_cb = readRGB;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
@ -157,7 +175,7 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
read_cb = readRGBA5551;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
@ -168,6 +186,13 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
// Detecting proper write callback and texture format
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
tex_format = SCE_GXM_TEXTURE_FORMAT_UBC1_ABGR;
break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
tex_format = SCE_GXM_TEXTURE_FORMAT_UBC3_ABGR;
break;
case GL_RGB:
write_cb = writeRGB;
tex_format = SCE_GXM_TEXTURE_FORMAT_U8U8U8_BGR;
@ -197,13 +222,13 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
tex_format = SCE_GXM_TEXTURE_FORMAT_P8_ABGR;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
// Checking if texture is too big for sceGxm
if (width > GXM_TEX_MAX_SIZE || height > GXM_TEX_MAX_SIZE) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
@ -211,9 +236,12 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
tex->type = internalFormat;
tex->write_cb = write_cb;
if (level == 0)
gpu_alloc_texture(width, height, tex_format, data, tex, data_bpp, read_cb, write_cb);
else
if (tex->write_cb) gpu_alloc_texture(width, height, tex_format, data, tex, data_bpp, read_cb, write_cb);
else gpu_alloc_compressed_texture(width, height, tex_format, data, tex, data_bpp, read_cb);
else {
gpu_alloc_mipmaps(level, tex);
sceGxmTextureSetMipFilter(&tex->gxm_tex, SCE_GXM_TEXTURE_MIP_FILTER_ENABLED);
}
// Setting texture parameters
sceGxmTextureSetUAddrMode(&tex->gxm_tex, tex_unit->u_mode);
@ -227,7 +255,7 @@ void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei widt
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -239,14 +267,40 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
texture *target_texture = &tex_unit->textures[texture2d_idx];
// Calculating implicit texture stride and start address of requested texture modification
uint32_t orig_w = sceGxmTextureGetWidth(&target_texture->gxm_tex);
uint32_t orig_h = sceGxmTextureGetHeight(&target_texture->gxm_tex);
SceGxmTextureFormat tex_format = sceGxmTextureGetFormat(&target_texture->gxm_tex);
uint8_t bpp = tex_format_to_bytespp(tex_format);
uint32_t stride = ALIGN(sceGxmTextureGetWidth(&target_texture->gxm_tex), 8) * bpp;
uint32_t stride = ALIGN(orig_w, 8) * bpp;
uint8_t *ptr = (uint8_t *)sceGxmTextureGetData(&target_texture->gxm_tex) + xoffset * bpp + yoffset * stride;
uint8_t *ptr_line = ptr;
uint8_t data_bpp = 0;
int i, j;
if (xoffset + width > orig_w) {
error = GL_INVALID_VALUE;
return;
} else if (yoffset + height > orig_h) {
error = GL_INVALID_VALUE;
return;
}
// Support for legacy GL1.0 format
switch (format) {
case 1:
format = GL_RED;
break;
case 2:
format = GL_RG;
break;
case 3:
format = GL_RGB;
break;
case 4:
format = GL_RGBA;
break;
}
/*
* Callbacks are actually used to just perform down/up-sampling
* between U8 texture formats. Reads are expected to give as result
@ -266,7 +320,8 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
data_bpp = 1;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
return;
break;
}
break;
@ -277,7 +332,8 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
data_bpp = 2;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
return;
break;
}
break;
@ -288,7 +344,8 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
read_cb = readRGB;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
return;
break;
}
break;
@ -303,7 +360,8 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
read_cb = readRGBA5551;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
return;
break;
}
break;
@ -324,7 +382,7 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
write_cb = writeR;
break;
case GL_LUMINANCE_ALPHA:
write_cb = writeRA;
write_cb = writeRG;
break;
case GL_INTENSITY:
write_cb = writeR;
@ -349,7 +407,7 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -370,12 +428,12 @@ void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum fo
bpp = 4;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
@ -409,7 +467,7 @@ void glTexParameteri(GLenum target, GLenum pname, GLint param) {
case GL_LINEAR_MIPMAP_LINEAR: // TODO: Implement this
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
sceGxmTextureSetMinFilter(&tex->gxm_tex, tex_unit->min_filter);
@ -431,7 +489,7 @@ void glTexParameteri(GLenum target, GLenum pname, GLint param) {
case GL_LINEAR_MIPMAP_LINEAR: // TODO: Implement this
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
sceGxmTextureSetMagFilter(&tex->gxm_tex, tex_unit->mag_filter);
@ -447,8 +505,11 @@ void glTexParameteri(GLenum target, GLenum pname, GLint param) {
case GL_MIRRORED_REPEAT: // Mirror
tex_unit->u_mode = SCE_GXM_TEXTURE_ADDR_MIRROR;
break;
case GL_MIRROR_CLAMP_EXT: // Mirror Clamp
tex_unit->u_mode = SCE_GXM_TEXTURE_ADDR_MIRROR_CLAMP;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
sceGxmTextureSetUAddrMode(&tex->gxm_tex, tex_unit->u_mode);
@ -464,19 +525,22 @@ void glTexParameteri(GLenum target, GLenum pname, GLint param) {
case GL_MIRRORED_REPEAT: // Mirror
tex_unit->v_mode = SCE_GXM_TEXTURE_ADDR_MIRROR;
break;
case GL_MIRROR_CLAMP_EXT: // Mirror Clamp
tex_unit->u_mode = SCE_GXM_TEXTURE_ADDR_MIRROR_CLAMP;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
sceGxmTextureSetVAddrMode(&tex->gxm_tex, tex_unit->v_mode);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -511,6 +575,8 @@ void glTexParameterf(GLenum target, GLenum pname, GLfloat param) {
tex_unit->u_mode = SCE_GXM_TEXTURE_ADDR_REPEAT; // Repeat
else if (param == GL_MIRRORED_REPEAT)
tex_unit->u_mode = SCE_GXM_TEXTURE_ADDR_MIRROR; // Mirror
else if (param == GL_MIRROR_CLAMP_EXT)
tex_unit->u_mode = SCE_GXM_TEXTURE_ADDR_MIRROR_CLAMP; // Mirror Clamp
sceGxmTextureSetUAddrMode(&tex->gxm_tex, tex_unit->u_mode);
break;
case GL_TEXTURE_WRAP_T: // V Mode
@ -520,15 +586,17 @@ void glTexParameterf(GLenum target, GLenum pname, GLfloat param) {
tex_unit->v_mode = SCE_GXM_TEXTURE_ADDR_REPEAT; // Repeat
else if (param == GL_MIRRORED_REPEAT)
tex_unit->v_mode = SCE_GXM_TEXTURE_ADDR_MIRROR; // Mirror
else if (param == GL_MIRROR_CLAMP_EXT)
tex_unit->u_mode = SCE_GXM_TEXTURE_ADDR_MIRROR_CLAMP; // Mirror Clamp
sceGxmTextureSetVAddrMode(&tex->gxm_tex, tex_unit->v_mode);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -537,7 +605,7 @@ void glActiveTexture(GLenum texture) {
// Changing current in use server texture unit
#ifndef SKIP_ERROR_HANDLING
if ((texture < GL_TEXTURE0) && (texture > GL_TEXTURE31))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
else
#endif
server_texture_unit = texture - GL_TEXTURE0;
@ -570,7 +638,7 @@ void glGenerateMipmap(GLenum target) {
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -596,12 +664,30 @@ void glTexEnvf(GLenum target, GLenum pname, GLfloat param) {
tex_unit->env_mode = ADD;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
}
}
void glTexEnvfv(GLenum target, GLenum pname, GLfloat *param) {
// Properly changing texture environment settings as per request
switch (target) {
case GL_TEXTURE_ENV:
switch (pname) {
case GL_TEXTURE_ENV_COLOR:
memcpy(&texenv_color.r, param, sizeof(GLfloat) * 4);
break;
default:
error = GL_INVALID_ENUM;
break;
}
break;
default:
error = GL_INVALID_ENUM;
}
}
@ -633,12 +719,12 @@ void glTexEnvi(GLenum target, GLenum pname, GLint param) {
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -654,7 +740,7 @@ void *vglGetTexDataPointer(GLenum target) {
return tex->data;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}

View File

@ -1,35 +1,107 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* gpu_utils.c:
* Utilities for GPU usage
*/
#include "../shared.h"
#include "stb_dxt.h"
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)<(b))?(b):(a))
#endif
// VRAM usage setting
uint8_t use_vram = 0;
uint8_t use_vram_for_usse = 0;
// Newlib mempool usage setting
GLboolean use_extra_mem = GL_TRUE;
// vitaGL memory pool setup
static void *pool_addr = NULL;
static unsigned int pool_index = 0;
static unsigned int pool_size = 0;
// USSE memory settings
vglMemType frag_usse_type;
vglMemType vert_usse_type;
uint64_t morton_1(uint64_t x)
{
x = x & 0x5555555555555555;
x = (x | (x >> 1)) & 0x3333333333333333;
x = (x | (x >> 2)) & 0x0F0F0F0F0F0F0F0F;
x = (x | (x >> 4)) & 0x00FF00FF00FF00FF;
x = (x | (x >> 8)) & 0x0000FFFF0000FFFF;
x = (x | (x >> 16)) & 0xFFFFFFFFFFFFFFFF;
return x;
}
void d2xy_morton(uint64_t d, uint64_t *x, uint64_t *y)
{
*x = morton_1(d);
*y = morton_1(d >> 1);
}
void extract_block(const uint8_t *src, int width, uint8_t *block) {
int j;
for (j = 0; j < 4; j++) {
memcpy(&block[j * 4 * 4], src, 16);
src += width * 4;
}
}
void dxt_compress(uint8_t *dst, uint8_t *src, int w, int h, int isdxt5) {
uint8_t block[64];
int s = MAX(w, h);
uint32_t num_blocks = (s * s) / 16;
uint64_t d, offs_x, offs_y;
for (d = 0; d < num_blocks; d++) {
d2xy_morton(d, &offs_x, &offs_y);
if (offs_x * 4 >= h) continue;
if (offs_y * 4 >= w) continue;
extract_block(src + offs_y * 16 + offs_x * w * 16, w, block);
stb_compress_dxt_block(dst, block, isdxt5, STB_DXT_HIGHQUAL);
dst += isdxt5 ? 16 : 8;
}
}
void *gpu_alloc_mapped(size_t size, vglMemType *type) {
// Allocating requested memblock
void *res = vitagl_mempool_alloc(size, *type);
void *res = mempool_alloc(size, *type);
// Requested memory type finished, using other one
if (res == NULL) {
*type = use_vram ? VGL_MEM_RAM : VGL_MEM_VRAM;
res = vitagl_mempool_alloc(size, *type);
*type = *type == VGL_MEM_VRAM ? VGL_MEM_RAM : VGL_MEM_VRAM;
res = mempool_alloc(size, *type);
}
// Even the other one failed, using our last resort
if (res == NULL) {
*type = VGL_MEM_SLOW;
res = vitagl_mempool_alloc(size, *type);
res = mempool_alloc(size, *type);
}
if (res == NULL) {
if (res == NULL && use_extra_mem) {
*type = VGL_MEM_EXTERNAL;
res = malloc(size);
}
@ -39,7 +111,8 @@ void *gpu_alloc_mapped(size_t size, vglMemType *type) {
void *gpu_vertex_usse_alloc_mapped(size_t size, unsigned int *usse_offset) {
// Allocating memblock
void *addr = vitagl_mempool_alloc(size, VGL_MEM_RAM);
vert_usse_type = use_vram_for_usse ? VGL_MEM_VRAM : VGL_MEM_RAM;
void *addr = gpu_alloc_mapped(size, &vert_usse_type);
// Mapping memblock into sceGxm as vertex USSE memory
sceGxmMapVertexUsseMemory(addr, size, usse_offset);
@ -53,12 +126,13 @@ void gpu_vertex_usse_free_mapped(void *addr) {
sceGxmUnmapVertexUsseMemory(addr);
// Deallocating memblock
vitagl_mempool_free(addr, VGL_MEM_RAM);
mempool_free(addr, vert_usse_type);
}
void *gpu_fragment_usse_alloc_mapped(size_t size, unsigned int *usse_offset) {
// Allocating memblock
void *addr = vitagl_mempool_alloc(size, VGL_MEM_RAM);
frag_usse_type = use_vram_for_usse ? VGL_MEM_VRAM : VGL_MEM_RAM;
void *addr = gpu_alloc_mapped(size, &frag_usse_type);
// Mapping memblock into sceGxm as fragment USSE memory
sceGxmMapFragmentUsseMemory(addr, size, usse_offset);
@ -72,7 +146,7 @@ void gpu_fragment_usse_free_mapped(void *addr) {
sceGxmUnmapFragmentUsseMemory(addr);
// Deallocating memblock
vitagl_mempool_free(addr, VGL_MEM_RAM);
mempool_free(addr, frag_usse_type);
}
void *gpu_pool_malloc(unsigned int size) {
@ -144,6 +218,15 @@ int tex_format_to_bytespp(SceGxmTextureFormat format) {
}
}
int tex_format_to_alignment(SceGxmTextureFormat format) {
switch (format & 0x9f000000U) {
case SCE_GXM_TEXTURE_BASE_FORMAT_UBC3:
return 16;
default:
return 8;
}
}
palette *gpu_alloc_palette(const void *data, uint32_t w, uint32_t bpe) {
// Allocating a palette object
palette *res = (palette *)malloc(sizeof(palette));
@ -166,7 +249,7 @@ palette *gpu_alloc_palette(const void *data, uint32_t w, uint32_t bpe) {
void gpu_free_texture(texture *tex) {
// Deallocating texture
if (tex->data != NULL)
vitagl_mempool_free(tex->data, tex->mtype);
mempool_free(tex->data, tex->mtype);
// Invalidating texture object
tex->valid = 0;
@ -214,6 +297,57 @@ void gpu_alloc_texture(uint32_t w, uint32_t h, SceGxmTextureFormat format, const
}
}
void gpu_alloc_compressed_texture(uint32_t w, uint32_t h, SceGxmTextureFormat format, const void *data, texture *tex, uint8_t src_bpp, uint32_t (*read_cb)(void *)) {
// If there's already a texture in passed texture object we first dealloc it
if (tex->valid)
gpu_free_texture(tex);
// Getting texture format alignment
uint8_t alignment = tex_format_to_alignment(format);
// Calculating swizzled compressed texture size on memory
tex->mtype = use_vram ? VGL_MEM_VRAM : VGL_MEM_RAM;
int tex_size = w * h;
if (alignment == 8) tex_size /= 2;
// Allocating texture data buffer
void *texture_data = gpu_alloc_mapped(tex_size, &tex->mtype);
// NOTE: Supports only GL_RGBA source format for now
// Initializing texture data buffer
if (texture_data != NULL) {
// Initializing texture data buffer
if (data != NULL) {
//void *tmp = malloc(w * h * 4);
//void *tmp2 = malloc(tex_size);
/*int i, j;
uint8_t *src = (uint8_t *)data;
uint32_t *dst = (uint32_t*)tmp;
for (i = 0; i < h * w; i++) {
uint32_t clr = read_cb(src);
writeRGBA(dst++, src);
src += src_bpp;
}*/
// Performing swizzling and DXT compression
dxt_compress(texture_data, (void*)data, w, h, alignment == 16);
//swizzle(texture_data, tmp2, w, h, alignment << 3);
//free(tmp);
//free(tmp2);
} else
memset(texture_data, 0, tex_size);
// Initializing texture and validating it
sceGxmTextureInitSwizzled(&tex->gxm_tex, texture_data, format, w, h, 0);
tex->palette_UID = 0;
tex->valid = 1;
tex->data = texture_data;
}
}
void gpu_alloc_mipmaps(int level, texture *tex) {
// Getting current mipmap count in passed texture
uint32_t count = sceGxmTextureGetMipmapCount(&tex->gxm_tex);
@ -325,6 +459,6 @@ void gpu_free_palette(palette *pal) {
// Deallocating palette memblock and object
if (pal == NULL)
return;
vitagl_mempool_free(pal->data, pal->type);
mempool_free(pal->data, pal->type);
free(pal);
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* gpu_utils.h:
* Header file for the GPU utilities exposed by gpu_utils.c
@ -66,6 +84,9 @@ int tex_format_to_bytespp(SceGxmTextureFormat format);
// Alloc a texture
void gpu_alloc_texture(uint32_t w, uint32_t h, SceGxmTextureFormat format, const void *data, texture *tex, uint8_t src_bpp, uint32_t (*read_cb)(void *), void (*write_cb)(void *, uint32_t));
// Alloc a compresseed texture
void gpu_alloc_compressed_texture(uint32_t w, uint32_t h, SceGxmTextureFormat format, const void *data, texture *tex, uint8_t src_bpp, uint32_t (*read_cb)(void *));
// Dealloc a texture
void gpu_free_texture(texture *tex);

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* math_utils.c:
* Utilities for math operations
@ -22,13 +40,13 @@ void matrix4x4_copy(matrix4x4 dst, const matrix4x4 src) {
}
void matrix4x4_multiply(matrix4x4 dst, const matrix4x4 src1, const matrix4x4 src2) {
matmul4_neon((float*)src2, (float*)src1, (float*)dst);
matmul4_neon((float *)src2, (float *)src1, (float *)dst);
}
void matrix4x4_init_rotation_x(matrix4x4 m, float rad) {
float cs[2];
sincosf_c(rad, cs);
matrix4x4_identity(m);
m[1][1] = cs[1];
@ -179,39 +197,51 @@ void matrix4x4_init_perspective(matrix4x4 m, float fov, float aspect, float near
int matrix4x4_invert(matrix4x4 out, const matrix4x4 m) {
int i, j;
float det;
matrix4x4 inv;
inv[0][0] = m[1][1] * m[2][2] * m[3][3] - m[1][1] * m[3][2] * m[2][3] - m[1][2] * m[2][1] * m[3][3] + m[1][2] * m[3][1] * m[2][3] + m[1][3] * m[2][1] * m[3][2] - m[1][3] * m[3][1] * m[2][2];
inv[0][1] = -m[0][1] * m[2][2] * m[3][3] + m[0][1] * m[3][2] * m[2][3] + m[0][2] * m[2][1] * m[3][3] - m[0][2] * m[3][1] * m[2][3] - m[0][3] * m[2][1] * m[3][2] + m[0][3] * m[3][1] * m[2][2];
inv[0][2] = m[0][1] * m[1][2] * m[3][3] - m[0][1] * m[3][2] * m[1][3] - m[0][2] * m[1][1] * m[3][3] + m[0][2] * m[3][1] * m[1][3] + m[0][3] * m[1][1] * m[3][2] - m[0][3] * m[3][1] * m[1][2];
inv[0][3] = -m[0][1] * m[1][2] * m[2][3] + m[0][1] * m[2][2] * m[1][3] + m[0][2] * m[1][1] * m[2][3] - m[0][2] * m[2][1] * m[1][3] - m[0][3] * m[1][1] * m[2][2] + m[0][3] * m[2][1] * m[1][2];
inv[1][0] = -m[1][0] * m[2][2] * m[3][3] + m[1][0] * m[3][2] * m[2][3] + m[1][2] * m[2][0] * m[3][3] - m[1][2] * m[3][0] * m[2][3] - m[1][3] * m[2][0] * m[3][2] + m[1][3] * m[3][0] * m[2][2];
inv[1][1] = m[0][0] * m[2][2] * m[3][3] - m[0][0] * m[3][2] * m[2][3] - m[0][2] * m[2][0] * m[3][3] + m[0][2] * m[3][0] * m[2][3] + m[0][3] * m[2][0] * m[3][2] - m[0][3] * m[3][0] * m[2][2];
inv[1][2] = -m[0][0] * m[1][2] * m[3][3] + m[0][0] * m[3][2] * m[1][3] + m[0][2] * m[1][0] * m[3][3] - m[0][2] * m[3][0] * m[1][3] - m[0][3] * m[1][0] * m[3][2] + m[0][3] * m[3][0] * m[1][2];
inv[1][3] = m[0][0] * m[1][2] * m[2][3] - m[0][0] * m[2][2] * m[1][3] - m[0][2] * m[1][0] * m[2][3] + m[0][2] * m[2][0] * m[1][3] + m[0][3] * m[1][0] * m[2][2] - m[0][3] * m[2][0] * m[1][2];
inv[2][0] = m[1][0] * m[2][1] * m[3][3] - m[1][0] * m[3][1] * m[2][3] - m[1][1] * m[2][0] * m[3][3] + m[1][1] * m[3][0] * m[2][3] + m[1][3] * m[2][0] * m[3][1] - m[1][3] * m[3][0] * m[2][1];
inv[2][1] = -m[0][0] * m[2][1] * m[3][3] + m[0][0] * m[3][1] * m[2][3] + m[0][1] * m[2][0] * m[3][3] - m[0][1] * m[3][0] * m[2][3] - m[0][3] * m[2][0] * m[3][1] + m[0][3] * m[3][0] * m[2][1];
inv[2][2] = m[0][0] * m[1][1] * m[3][3] - m[0][0] * m[3][1] * m[1][3] - m[0][1] * m[1][0] * m[3][3] + m[0][1] * m[3][0] * m[1][3] + m[0][3] * m[1][0] * m[3][1] - m[0][3] * m[3][0] * m[1][1];
inv[2][3] = -m[0][0] * m[1][1] * m[2][3] + m[0][0] * m[2][1] * m[1][3] + m[0][1] * m[1][0] * m[2][3] - m[0][1] * m[2][0] * m[1][3] - m[0][3] * m[1][0] * m[2][1] + m[0][3] * m[2][0] * m[1][1];
inv[3][0] = -m[1][0] * m[2][1] * m[3][2] + m[1][0] * m[3][1] * m[2][2] + m[1][1] * m[2][0] * m[3][2] - m[1][1] * m[3][0] * m[2][2] - m[1][2] * m[2][0] * m[3][1] + m[1][2] * m[3][0] * m[2][1];
inv[3][1] = m[0][0] * m[2][1] * m[3][2] - m[0][0] * m[3][1] * m[2][2] - m[0][1] * m[2][0] * m[3][2] + m[0][1] * m[3][0] * m[2][2] + m[0][2] * m[2][0] * m[3][1] - m[0][2] * m[3][0] * m[2][1];
inv[3][2] = -m[0][0] * m[1][1] * m[3][2] + m[0][0] * m[3][1] * m[1][2] + m[0][1] * m[1][0] * m[3][2] - m[0][1] * m[3][0] * m[1][2] - m[0][2] * m[1][0] * m[3][1] + m[0][2] * m[3][0] * m[1][1];
inv[3][3] = m[0][0] * m[1][1] * m[2][2] - m[0][0] * m[2][1] * m[1][2] - m[0][1] * m[1][0] * m[2][2] + m[0][1] * m[2][0] * m[1][2] + m[0][2] * m[1][0] * m[2][1] - m[0][2] * m[2][0] * m[1][1];
const float a0 = m[0][0] * m[1][1] - m[0][1] * m[1][0];
const float a1 = m[0][0] * m[1][2] - m[0][2] * m[1][0];
const float a2 = m[0][0] * m[1][3] - m[0][3] * m[1][0];
const float a3 = m[0][1] * m[1][2] - m[0][2] * m[1][1];
const float a4 = m[0][1] * m[1][3] - m[0][3] * m[1][1];
const float a5 = m[0][2] * m[1][3] - m[0][3] * m[1][2];
const float b0 = m[2][0] * m[3][1] - m[2][1] * m[3][0];
const float b1 = m[2][0] * m[3][2] - m[2][2] * m[3][0];
const float b2 = m[2][0] * m[3][3] - m[2][3] * m[3][0];
const float b3 = m[2][1] * m[3][2] - m[2][2] * m[3][1];
const float b4 = m[2][1] * m[3][3] - m[2][3] * m[3][1];
const float b5 = m[2][2] * m[3][3] - m[2][3] * m[3][2];
det = m[0][0] * inv[0][0] + m[1][0] * inv[0][1] + m[2][0] * inv[0][2] + m[3][0] * inv[0][3];
float det = a0 * b5 - a1 * b4 + a2 * b3 + a3 * b2 - a4 * b1 + a5 * b0;
if (det == 0)
return 0;
if (fabsf(det) > 0.0001f) {
out[0][0] = m[0][1] * b5 - m[1][2] * b4 + m[1][3] * b3;
out[1][0] = -m[1][0] * b5 + m[1][2] * b2 - m[1][3] * b1;
out[2][0] = m[1][0] * b4 - m[1][1] * b2 + m[1][3] * b0;
out[3][0] = -m[1][0] * b3 + m[1][1] * b1 - m[1][2] * b0;
out[0][1] = -m[0][1] * b5 + m[0][2] * b4 - m[0][3] * b3;
out[1][1] = m[0][0] * b5 - m[0][2] * b2 + m[0][3] * b1;
out[2][1] = -m[0][0] * b4 + m[0][1] * b2 - m[0][3] * b0;
out[3][1] = m[0][0] * b3 - m[0][1] * b1 + m[0][2] * b0;
out[0][2] = m[3][1] * a5 - m[3][2] * a4 + m[3][3] * a3;
out[1][2] = -m[3][0] * a5 + m[3][2] * a2 - m[3][3] * a1;
out[2][2] = m[3][0] * a4 - m[3][1] * a2 + m[3][3] * a0;
out[3][2] = -m[3][0] * a3 + m[3][1] * a1 - m[3][2] * a0;
out[0][3] = -m[2][1] * a5 + m[2][2] * a4 - m[2][3] * a3;
out[1][3] = m[2][0] * a5 - m[2][2] * a2 + m[2][3] * a1;
out[2][3] = -m[2][0] * a4 + m[2][1] * a2 - m[2][3] * a0;
out[3][3] = m[2][0] * a3 - m[2][1] * a1 + m[2][2] * a0;
det = 1.0 / det;
det = 1.0f / det;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
out[i][j] = inv[i][j] * det;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
out[i][j] *= det;
}
return 1;
}
return 1;
return 0;
}
void vector4f_matrix4x4_mult(vector4f *u, const matrix4x4 m, const vector4f *v) {

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* math_utils.h:
* Header file for the math utilities exposed by math_utils.c

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* mem_utils.c:
* Utilities for memory management
@ -238,7 +256,7 @@ static void heap_free(void *addr) {
heap_blk_free((uintptr_t)addr);
}
void vitagl_mem_term(void) {
void mem_term(void) {
heap_destroy();
if (mempool_addr[0] != NULL) {
sceKernelFreeMemBlock(mempool_id[0]);
@ -250,9 +268,9 @@ void vitagl_mem_term(void) {
}
}
int vitagl_mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont) {
int mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont) {
if (mempool_addr[0] != NULL)
vitagl_mem_term();
mem_term();
mempool_size[0] = ALIGN(size_cdram, 256 * 1024);
mempool_size[1] = ALIGN(size_ram, 4 * 1024);
@ -277,14 +295,14 @@ int vitagl_mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont) {
return 1;
}
void vitagl_mempool_free(void *ptr, vglMemType type) {
void mempool_free(void *ptr, vglMemType type) {
if (type == VGL_MEM_EXTERNAL)
free(ptr);
else
heap_free(ptr); // type is already stored in heap for alloc'd blocks
}
void *vitagl_mempool_alloc(size_t size, vglMemType type) {
void *mempool_alloc(size_t size, vglMemType type) {
void *res = NULL;
if (size <= tm_free[type])
res = heap_alloc(type, size, MEM_ALIGNMENT);
@ -292,6 +310,6 @@ void *vitagl_mempool_alloc(size_t size, vglMemType type) {
}
// Returns currently free space on mempool
size_t vitagl_mempool_get_free_space(vglMemType type) {
size_t mempool_get_free_space(vglMemType type) {
return tm_free[type];
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* mem_utils.h:
* Header file for the memory management utilities exposed by mem_utils.c
@ -6,10 +24,10 @@
#ifndef _MEM_UTILS_H_
#define _MEM_UTILS_H_
int vitagl_mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont); // Initialize mempools
void vitagl_mem_term(void); // Terminate both CDRAM and RAM mempools
size_t vitagl_mempool_get_free_space(vglMemType type); // Return free space in bytes for a mempool
void *vitagl_mempool_alloc(size_t size, vglMemType type); // Allocate a memory block on a mempool
void vitagl_mempool_free(void *ptr, vglMemType type); // Free a memory block on a mempool
int mem_init(size_t size_ram, size_t size_cdram, size_t size_phycont); // Initialize mempools
void mem_term(void); // Terminate both CDRAM and RAM mempools
size_t mempool_get_free_space(vglMemType type); // Return free space in bytes for a mempool
void *mempool_alloc(size_t size, vglMemType type); // Allocate a memory block on a mempool
void mempool_free(void *ptr, vglMemType type); // Free a memory block on a mempool
#endif

748
deps/vitaGL/source/utils/stb_dxt.h vendored Normal file
View File

@ -0,0 +1,748 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// stb_dxt.h - v1.09 - DXT1/DXT5 compressor - public domain
// original by fabian "ryg" giesen - ported to C by stb
// use '#define STB_DXT_IMPLEMENTATION' before including to create the implementation
//
// USAGE:
// call stb_compress_dxt_block() for every block (you must pad)
// source should be a 4x4 block of RGBA data in row-major order;
// Alpha channel is not stored if you specify alpha=0 (but you
// must supply some constant alpha in the alpha channel).
// You can turn on dithering and "high quality" using mode.
//
// version history:
// v1.09 - (stb) update documentation re: surprising alpha channel requirement
// v1.08 - (stb) fix bug in dxt-with-alpha block
// v1.07 - (stb) bc4; allow not using libc; add STB_DXT_STATIC
// v1.06 - (stb) fix to known-broken 1.05
// v1.05 - (stb) support bc5/3dc (Arvids Kokins), use extern "C" in C++ (Pavel Krajcevski)
// v1.04 - (ryg) default to no rounding bias for lerped colors (as per S3TC/DX10 spec);
// single color match fix (allow for inexact color interpolation);
// optimal DXT5 index finder; "high quality" mode that runs multiple refinement steps.
// v1.03 - (stb) endianness support
// v1.02 - (stb) fix alpha encoding bug
// v1.01 - (stb) fix bug converting to RGB that messed up quality, thanks ryg & cbloom
// v1.00 - (stb) first release
//
// contributors:
// Kevin Schmidt (#defines for "freestanding" compilation)
// github:ppiastucki (BC4 support)
//
// LICENSE
//
// See end of file for license information.
#ifndef STB_INCLUDE_STB_DXT_H
#define STB_INCLUDE_STB_DXT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef STB_DXT_STATIC
#define STBDDEF static
#else
#define STBDDEF extern
#endif
// compression mode (bitflags)
#define STB_DXT_NORMAL 0
#define STB_DXT_DITHER 1 // use dithering. dubious win. never use for normal maps and the like!
#define STB_DXT_HIGHQUAL 2 // high quality mode, does two refinement steps instead of 1. ~30-40% slower.
STBDDEF void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src_rgba_four_bytes_per_pixel, int alpha, int mode);
STBDDEF void stb_compress_bc4_block(unsigned char *dest, const unsigned char *src_r_one_byte_per_pixel);
STBDDEF void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src_rg_two_byte_per_pixel);
#define STB_COMPRESS_DXT_BLOCK
#ifdef __cplusplus
}
#endif
#endif // STB_INCLUDE_STB_DXT_H
#ifdef STB_DXT_IMPLEMENTATION
// configuration options for DXT encoder. set them in the project/makefile or just define
// them at the top.
// STB_DXT_USE_ROUNDING_BIAS
// use a rounding bias during color interpolation. this is closer to what "ideal"
// interpolation would do but doesn't match the S3TC/DX10 spec. old versions (pre-1.03)
// implicitly had this turned on.
//
// in case you're targeting a specific type of hardware (e.g. console programmers):
// NVidia and Intel GPUs (as of 2010) as well as DX9 ref use DXT decoders that are closer
// to STB_DXT_USE_ROUNDING_BIAS. AMD/ATI, S3 and DX10 ref are closer to rounding with no bias.
// you also see "(a*5 + b*3) / 8" on some old GPU designs.
// #define STB_DXT_USE_ROUNDING_BIAS
#include <stdlib.h>
#if !defined(STBD_ABS) || !defined(STBI_FABS)
#include <math.h>
#endif
#ifndef STBD_ABS
#define STBD_ABS(i) abs(i)
#endif
#ifndef STBD_FABS
#define STBD_FABS(x) fabs(x)
#endif
#ifndef STBD_MEMSET
#include <string.h>
#define STBD_MEMSET memset
#endif
static unsigned char stb__Expand5[32];
static unsigned char stb__Expand6[64];
static unsigned char stb__OMatch5[256][2];
static unsigned char stb__OMatch6[256][2];
static unsigned char stb__QuantRBTab[256+16];
static unsigned char stb__QuantGTab[256+16];
static int stb__Mul8Bit(int a, int b)
{
int t = a*b + 128;
return (t + (t >> 8)) >> 8;
}
static void stb__From16Bit(unsigned char *out, unsigned short v)
{
int rv = (v & 0xf800) >> 11;
int gv = (v & 0x07e0) >> 5;
int bv = (v & 0x001f) >> 0;
out[0] = stb__Expand5[rv];
out[1] = stb__Expand6[gv];
out[2] = stb__Expand5[bv];
out[3] = 0;
}
static unsigned short stb__As16Bit(int r, int g, int b)
{
return (unsigned short)((stb__Mul8Bit(r,31) << 11) + (stb__Mul8Bit(g,63) << 5) + stb__Mul8Bit(b,31));
}
// linear interpolation at 1/3 point between a and b, using desired rounding type
static int stb__Lerp13(int a, int b)
{
#ifdef STB_DXT_USE_ROUNDING_BIAS
// with rounding bias
return a + stb__Mul8Bit(b-a, 0x55);
#else
// without rounding bias
// replace "/ 3" by "* 0xaaab) >> 17" if your compiler sucks or you really need every ounce of speed.
return (2*a + b) / 3;
#endif
}
// lerp RGB color
static void stb__Lerp13RGB(unsigned char *out, unsigned char *p1, unsigned char *p2)
{
out[0] = (unsigned char)stb__Lerp13(p1[0], p2[0]);
out[1] = (unsigned char)stb__Lerp13(p1[1], p2[1]);
out[2] = (unsigned char)stb__Lerp13(p1[2], p2[2]);
}
/****************************************************************************/
// compute table to reproduce constant colors as accurately as possible
static void stb__PrepareOptTable(unsigned char *Table,const unsigned char *expand,int size)
{
int i,mn,mx;
for (i=0;i<256;i++) {
int bestErr = 256;
for (mn=0;mn<size;mn++) {
for (mx=0;mx<size;mx++) {
int mine = expand[mn];
int maxe = expand[mx];
int err = STBD_ABS(stb__Lerp13(maxe, mine) - i);
// DX10 spec says that interpolation must be within 3% of "correct" result,
// add this as error term. (normally we'd expect a random distribution of
// +-1.5% error, but nowhere in the spec does it say that the error has to be
// unbiased - better safe than sorry).
err += STBD_ABS(maxe - mine) * 3 / 100;
if(err < bestErr)
{
Table[i*2+0] = (unsigned char)mx;
Table[i*2+1] = (unsigned char)mn;
bestErr = err;
}
}
}
}
}
static void stb__EvalColors(unsigned char *color,unsigned short c0,unsigned short c1)
{
stb__From16Bit(color+ 0, c0);
stb__From16Bit(color+ 4, c1);
stb__Lerp13RGB(color+ 8, color+0, color+4);
stb__Lerp13RGB(color+12, color+4, color+0);
}
// Block dithering function. Simply dithers a block to 565 RGB.
// (Floyd-Steinberg)
static void stb__DitherBlock(unsigned char *dest, unsigned char *block)
{
int err[8],*ep1 = err,*ep2 = err+4, *et;
int ch,y;
// process channels separately
for (ch=0; ch<3; ++ch) {
unsigned char *bp = block+ch, *dp = dest+ch;
unsigned char *quant = (ch == 1) ? stb__QuantGTab+8 : stb__QuantRBTab+8;
STBD_MEMSET(err, 0, sizeof(err));
for(y=0; y<4; ++y) {
dp[ 0] = quant[bp[ 0] + ((3*ep2[1] + 5*ep2[0]) >> 4)];
ep1[0] = bp[ 0] - dp[ 0];
dp[ 4] = quant[bp[ 4] + ((7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]) >> 4)];
ep1[1] = bp[ 4] - dp[ 4];
dp[ 8] = quant[bp[ 8] + ((7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]) >> 4)];
ep1[2] = bp[ 8] - dp[ 8];
dp[12] = quant[bp[12] + ((7*ep1[2] + 5*ep2[3] + ep2[2]) >> 4)];
ep1[3] = bp[12] - dp[12];
bp += 16;
dp += 16;
et = ep1, ep1 = ep2, ep2 = et; // swap
}
}
}
// The color matching function
static unsigned int stb__MatchColorsBlock(unsigned char *block, unsigned char *color,int dither)
{
unsigned int mask = 0;
int dirr = color[0*4+0] - color[1*4+0];
int dirg = color[0*4+1] - color[1*4+1];
int dirb = color[0*4+2] - color[1*4+2];
int dots[16];
int stops[4];
int i;
int c0Point, halfPoint, c3Point;
for(i=0;i<16;i++)
dots[i] = block[i*4+0]*dirr + block[i*4+1]*dirg + block[i*4+2]*dirb;
for(i=0;i<4;i++)
stops[i] = color[i*4+0]*dirr + color[i*4+1]*dirg + color[i*4+2]*dirb;
// think of the colors as arranged on a line; project point onto that line, then choose
// next color out of available ones. we compute the crossover points for "best color in top
// half"/"best in bottom half" and then the same inside that subinterval.
//
// relying on this 1d approximation isn't always optimal in terms of euclidean distance,
// but it's very close and a lot faster.
// http://cbloomrants.blogspot.com/2008/12/12-08-08-dxtc-summary.html
c0Point = (stops[1] + stops[3]) >> 1;
halfPoint = (stops[3] + stops[2]) >> 1;
c3Point = (stops[2] + stops[0]) >> 1;
if(!dither) {
// the version without dithering is straightforward
for (i=15;i>=0;i--) {
int dot = dots[i];
mask <<= 2;
if(dot < halfPoint)
mask |= (dot < c0Point) ? 1 : 3;
else
mask |= (dot < c3Point) ? 2 : 0;
}
} else {
// with floyd-steinberg dithering
int err[8],*ep1 = err,*ep2 = err+4;
int *dp = dots, y;
c0Point <<= 4;
halfPoint <<= 4;
c3Point <<= 4;
for(i=0;i<8;i++)
err[i] = 0;
for(y=0;y<4;y++)
{
int dot,lmask,step;
dot = (dp[0] << 4) + (3*ep2[1] + 5*ep2[0]);
if(dot < halfPoint)
step = (dot < c0Point) ? 1 : 3;
else
step = (dot < c3Point) ? 2 : 0;
ep1[0] = dp[0] - stops[step];
lmask = step;
dot = (dp[1] << 4) + (7*ep1[0] + 3*ep2[2] + 5*ep2[1] + ep2[0]);
if(dot < halfPoint)
step = (dot < c0Point) ? 1 : 3;
else
step = (dot < c3Point) ? 2 : 0;
ep1[1] = dp[1] - stops[step];
lmask |= step<<2;
dot = (dp[2] << 4) + (7*ep1[1] + 3*ep2[3] + 5*ep2[2] + ep2[1]);
if(dot < halfPoint)
step = (dot < c0Point) ? 1 : 3;
else
step = (dot < c3Point) ? 2 : 0;
ep1[2] = dp[2] - stops[step];
lmask |= step<<4;
dot = (dp[3] << 4) + (7*ep1[2] + 5*ep2[3] + ep2[2]);
if(dot < halfPoint)
step = (dot < c0Point) ? 1 : 3;
else
step = (dot < c3Point) ? 2 : 0;
ep1[3] = dp[3] - stops[step];
lmask |= step<<6;
dp += 4;
mask |= lmask << (y*8);
{ int *et = ep1; ep1 = ep2; ep2 = et; } // swap
}
}
return mask;
}
// The color optimization function. (Clever code, part 1)
static void stb__OptimizeColorsBlock(unsigned char *block, unsigned short *pmax16, unsigned short *pmin16)
{
int mind = 0x7fffffff,maxd = -0x7fffffff;
unsigned char *minp, *maxp;
double magn;
int v_r,v_g,v_b;
static const int nIterPower = 4;
float covf[6],vfr,vfg,vfb;
// determine color distribution
int cov[6];
int mu[3],min[3],max[3];
int ch,i,iter;
for(ch=0;ch<3;ch++)
{
const unsigned char *bp = ((const unsigned char *) block) + ch;
int muv,minv,maxv;
muv = minv = maxv = bp[0];
for(i=4;i<64;i+=4)
{
muv += bp[i];
if (bp[i] < minv) minv = bp[i];
else if (bp[i] > maxv) maxv = bp[i];
}
mu[ch] = (muv + 8) >> 4;
min[ch] = minv;
max[ch] = maxv;
}
// determine covariance matrix
for (i=0;i<6;i++)
cov[i] = 0;
for (i=0;i<16;i++)
{
int r = block[i*4+0] - mu[0];
int g = block[i*4+1] - mu[1];
int b = block[i*4+2] - mu[2];
cov[0] += r*r;
cov[1] += r*g;
cov[2] += r*b;
cov[3] += g*g;
cov[4] += g*b;
cov[5] += b*b;
}
// convert covariance matrix to float, find principal axis via power iter
for(i=0;i<6;i++)
covf[i] = cov[i] / 255.0f;
vfr = (float) (max[0] - min[0]);
vfg = (float) (max[1] - min[1]);
vfb = (float) (max[2] - min[2]);
for(iter=0;iter<nIterPower;iter++)
{
float r = vfr*covf[0] + vfg*covf[1] + vfb*covf[2];
float g = vfr*covf[1] + vfg*covf[3] + vfb*covf[4];
float b = vfr*covf[2] + vfg*covf[4] + vfb*covf[5];
vfr = r;
vfg = g;
vfb = b;
}
magn = STBD_FABS(vfr);
if (STBD_FABS(vfg) > magn) magn = STBD_FABS(vfg);
if (STBD_FABS(vfb) > magn) magn = STBD_FABS(vfb);
if(magn < 4.0f) { // too small, default to luminance
v_r = 299; // JPEG YCbCr luma coefs, scaled by 1000.
v_g = 587;
v_b = 114;
} else {
magn = 512.0 / magn;
v_r = (int) (vfr * magn);
v_g = (int) (vfg * magn);
v_b = (int) (vfb * magn);
}
// Pick colors at extreme points
for(i=0;i<16;i++)
{
int dot = block[i*4+0]*v_r + block[i*4+1]*v_g + block[i*4+2]*v_b;
if (dot < mind) {
mind = dot;
minp = block+i*4;
}
if (dot > maxd) {
maxd = dot;
maxp = block+i*4;
}
}
*pmax16 = stb__As16Bit(maxp[0],maxp[1],maxp[2]);
*pmin16 = stb__As16Bit(minp[0],minp[1],minp[2]);
}
static int stb__sclamp(float y, int p0, int p1)
{
int x = (int) y;
if (x < p0) return p0;
if (x > p1) return p1;
return x;
}
// The refinement function. (Clever code, part 2)
// Tries to optimize colors to suit block contents better.
// (By solving a least squares system via normal equations+Cramer's rule)
static int stb__RefineBlock(unsigned char *block, unsigned short *pmax16, unsigned short *pmin16, unsigned int mask)
{
static const int w1Tab[4] = { 3,0,2,1 };
static const int prods[4] = { 0x090000,0x000900,0x040102,0x010402 };
// ^some magic to save a lot of multiplies in the accumulating loop...
// (precomputed products of weights for least squares system, accumulated inside one 32-bit register)
float frb,fg;
unsigned short oldMin, oldMax, min16, max16;
int i, akku = 0, xx,xy,yy;
int At1_r,At1_g,At1_b;
int At2_r,At2_g,At2_b;
unsigned int cm = mask;
oldMin = *pmin16;
oldMax = *pmax16;
if((mask ^ (mask<<2)) < 4) // all pixels have the same index?
{
// yes, linear system would be singular; solve using optimal
// single-color match on average color
int r = 8, g = 8, b = 8;
for (i=0;i<16;++i) {
r += block[i*4+0];
g += block[i*4+1];
b += block[i*4+2];
}
r >>= 4; g >>= 4; b >>= 4;
max16 = (stb__OMatch5[r][0]<<11) | (stb__OMatch6[g][0]<<5) | stb__OMatch5[b][0];
min16 = (stb__OMatch5[r][1]<<11) | (stb__OMatch6[g][1]<<5) | stb__OMatch5[b][1];
} else {
At1_r = At1_g = At1_b = 0;
At2_r = At2_g = At2_b = 0;
for (i=0;i<16;++i,cm>>=2) {
int step = cm&3;
int w1 = w1Tab[step];
int r = block[i*4+0];
int g = block[i*4+1];
int b = block[i*4+2];
akku += prods[step];
At1_r += w1*r;
At1_g += w1*g;
At1_b += w1*b;
At2_r += r;
At2_g += g;
At2_b += b;
}
At2_r = 3*At2_r - At1_r;
At2_g = 3*At2_g - At1_g;
At2_b = 3*At2_b - At1_b;
// extract solutions and decide solvability
xx = akku >> 16;
yy = (akku >> 8) & 0xff;
xy = (akku >> 0) & 0xff;
frb = 3.0f * 31.0f / 255.0f / (xx*yy - xy*xy);
fg = frb * 63.0f / 31.0f;
// solve.
max16 = (unsigned short)(stb__sclamp((At1_r*yy - At2_r*xy)*frb+0.5f,0,31) << 11);
max16 |= (unsigned short)(stb__sclamp((At1_g*yy - At2_g*xy)*fg +0.5f,0,63) << 5);
max16 |= (unsigned short)(stb__sclamp((At1_b*yy - At2_b*xy)*frb+0.5f,0,31) << 0);
min16 = (unsigned short)(stb__sclamp((At2_r*xx - At1_r*xy)*frb+0.5f,0,31) << 11);
min16 |= (unsigned short)(stb__sclamp((At2_g*xx - At1_g*xy)*fg +0.5f,0,63) << 5);
min16 |= (unsigned short)(stb__sclamp((At2_b*xx - At1_b*xy)*frb+0.5f,0,31) << 0);
}
*pmin16 = min16;
*pmax16 = max16;
return oldMin != min16 || oldMax != max16;
}
// Color block compression
static void stb__CompressColorBlock(unsigned char *dest, unsigned char *block, int mode)
{
unsigned int mask;
int i;
int dither;
int refinecount;
unsigned short max16, min16;
unsigned char dblock[16*4],color[4*4];
dither = mode & STB_DXT_DITHER;
refinecount = (mode & STB_DXT_HIGHQUAL) ? 2 : 1;
// check if block is constant
for (i=1;i<16;i++)
if (((unsigned int *) block)[i] != ((unsigned int *) block)[0])
break;
if(i == 16) { // constant color
int r = block[0], g = block[1], b = block[2];
mask = 0xaaaaaaaa;
max16 = (stb__OMatch5[r][0]<<11) | (stb__OMatch6[g][0]<<5) | stb__OMatch5[b][0];
min16 = (stb__OMatch5[r][1]<<11) | (stb__OMatch6[g][1]<<5) | stb__OMatch5[b][1];
} else {
// first step: compute dithered version for PCA if desired
if(dither)
stb__DitherBlock(dblock,block);
// second step: pca+map along principal axis
stb__OptimizeColorsBlock(dither ? dblock : block,&max16,&min16);
if (max16 != min16) {
stb__EvalColors(color,max16,min16);
mask = stb__MatchColorsBlock(block,color,dither);
} else
mask = 0;
// third step: refine (multiple times if requested)
for (i=0;i<refinecount;i++) {
unsigned int lastmask = mask;
if (stb__RefineBlock(dither ? dblock : block,&max16,&min16,mask)) {
if (max16 != min16) {
stb__EvalColors(color,max16,min16);
mask = stb__MatchColorsBlock(block,color,dither);
} else {
mask = 0;
break;
}
}
if(mask == lastmask)
break;
}
}
// write the color block
if(max16 < min16)
{
unsigned short t = min16;
min16 = max16;
max16 = t;
mask ^= 0x55555555;
}
dest[0] = (unsigned char) (max16);
dest[1] = (unsigned char) (max16 >> 8);
dest[2] = (unsigned char) (min16);
dest[3] = (unsigned char) (min16 >> 8);
dest[4] = (unsigned char) (mask);
dest[5] = (unsigned char) (mask >> 8);
dest[6] = (unsigned char) (mask >> 16);
dest[7] = (unsigned char) (mask >> 24);
}
// Alpha block compression (this is easy for a change)
static void stb__CompressAlphaBlock(unsigned char *dest,unsigned char *src, int stride)
{
int i,dist,bias,dist4,dist2,bits,mask;
// find min/max color
int mn,mx;
mn = mx = src[0];
for (i=1;i<16;i++)
{
if (src[i*stride] < mn) mn = src[i*stride];
else if (src[i*stride] > mx) mx = src[i*stride];
}
// encode them
dest[0] = (unsigned char)mx;
dest[1] = (unsigned char)mn;
dest += 2;
// determine bias and emit color indices
// given the choice of mx/mn, these indices are optimal:
// http://fgiesen.wordpress.com/2009/12/15/dxt5-alpha-block-index-determination/
dist = mx-mn;
dist4 = dist*4;
dist2 = dist*2;
bias = (dist < 8) ? (dist - 1) : (dist/2 + 2);
bias -= mn * 7;
bits = 0,mask=0;
for (i=0;i<16;i++) {
int a = src[i*stride]*7 + bias;
int ind,t;
// select index. this is a "linear scale" lerp factor between 0 (val=min) and 7 (val=max).
t = (a >= dist4) ? -1 : 0; ind = t & 4; a -= dist4 & t;
t = (a >= dist2) ? -1 : 0; ind += t & 2; a -= dist2 & t;
ind += (a >= dist);
// turn linear scale into DXT index (0/1 are extremal pts)
ind = -ind & 7;
ind ^= (2 > ind);
// write index
mask |= ind << bits;
if((bits += 3) >= 8) {
*dest++ = (unsigned char)mask;
mask >>= 8;
bits -= 8;
}
}
}
static void stb__InitDXT()
{
int i;
for(i=0;i<32;i++)
stb__Expand5[i] = (unsigned char)((i<<3)|(i>>2));
for(i=0;i<64;i++)
stb__Expand6[i] = (unsigned char)((i<<2)|(i>>4));
for(i=0;i<256+16;i++)
{
int v = i-8 < 0 ? 0 : i-8 > 255 ? 255 : i-8;
stb__QuantRBTab[i] = stb__Expand5[stb__Mul8Bit(v,31)];
stb__QuantGTab[i] = stb__Expand6[stb__Mul8Bit(v,63)];
}
stb__PrepareOptTable(&stb__OMatch5[0][0],stb__Expand5,32);
stb__PrepareOptTable(&stb__OMatch6[0][0],stb__Expand6,64);
}
void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src, int alpha, int mode)
{
unsigned char data[16][4];
static int init=1;
if (init) {
stb__InitDXT();
init=0;
}
if (alpha) {
int i;
stb__CompressAlphaBlock(dest,(unsigned char*) src+3, 4);
dest += 8;
// make a new copy of the data in which alpha is opaque,
// because code uses a fast test for color constancy
memcpy(data, src, 4*16);
for (i=0; i < 16; ++i)
data[i][3] = 255;
src = &data[0][0];
}
stb__CompressColorBlock(dest,(unsigned char*) src,mode);
}
void stb_compress_bc4_block(unsigned char *dest, const unsigned char *src)
{
stb__CompressAlphaBlock(dest,(unsigned char*) src, 1);
}
void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src)
{
stb__CompressAlphaBlock(dest,(unsigned char*) src,2);
stb__CompressAlphaBlock(dest + 8,(unsigned char*) src+1,2);
}
#endif // STB_DXT_IMPLEMENTATION
/*
------------------------------------------------------------------------------
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Sean Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
*/

View File

@ -1,3 +1,22 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
* Copyright 2020 Asakura Reiko
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
*
*/
@ -23,13 +42,20 @@ typedef struct gpubuffer {
// sceGxm viewport setup (NOTE: origin is on center screen)
float x_port = 480.0f;
float y_port = -272.0f;
float y_port = 272.0f;
float z_port = 0.5f;
float x_scale = 480.0f;
float y_scale = 272.0f;
float y_scale = -272.0f;
float z_scale = 0.5f;
uint8_t viewport_mode = 0; // Current setting for viewport mode
// Fullscreen sceGxm viewport (NOTE: origin is on center screen)
float fullscreen_x_port = 480.0f;
float fullscreen_y_port = 272.0f;
float fullscreen_z_port = 0.5f;
float fullscreen_x_scale = 480.0f;
float fullscreen_y_scale = -272.0f;
float fullscreen_z_scale = 0.5f;
GLboolean vblank = GL_TRUE; // Current setting for VSync
extern int _newlib_heap_memblock; // Newlib Heap memblock
@ -51,14 +77,14 @@ uint16_t *depth_clear_indices = NULL; // Memblock starting address for clear scr
// Clear shaders
SceGxmVertexProgram *clear_vertex_program_patched; // Patched vertex program for clearing screen
vector2f *clear_vertices = NULL; // Memblock starting address for clear screen vertices
vector4f *clear_vertices = NULL; // Memblock starting address for clear screen vertices
vector3f *depth_vertices = NULL; // Memblock starting address for depth clear screen vertices
// Internal stuffs
SceGxmMultisampleMode msaa_mode = SCE_GXM_MULTISAMPLE_NONE;
static SceGxmBlendInfo *cur_blend_info_ptr = NULL;
extern uint8_t use_vram;
extern uint8_t use_vram_for_usse;
static GLuint buffers[BUFFERS_NUM]; // Buffers array
static gpubuffer gpu_buffers[BUFFERS_NUM]; // Buffers array
@ -129,7 +155,6 @@ void change_blend_factor() {
blend_info.alphaDst = blend_dfactor_a;
_change_blend_factor(&blend_info);
cur_blend_info_ptr = &blend_info;
if (cur_program != 0) {
reloadCustomShader();
}
@ -138,15 +163,14 @@ void change_blend_factor() {
void change_blend_mask() {
static SceGxmBlendInfo blend_info;
blend_info.colorMask = blend_color_mask;
blend_info.colorFunc = SCE_GXM_BLEND_FUNC_ADD;
blend_info.alphaFunc = SCE_GXM_BLEND_FUNC_ADD;
blend_info.colorFunc = SCE_GXM_BLEND_FUNC_NONE;
blend_info.alphaFunc = SCE_GXM_BLEND_FUNC_NONE;
blend_info.colorSrc = SCE_GXM_BLEND_FACTOR_SRC_ALPHA;
blend_info.colorDst = SCE_GXM_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
blend_info.alphaSrc = SCE_GXM_BLEND_FACTOR_ONE;
blend_info.alphaDst = SCE_GXM_BLEND_FACTOR_ZERO;
_change_blend_factor(&blend_info);
cur_blend_info_ptr = &blend_info;
if (cur_program != 0) {
reloadCustomShader();
}
@ -155,7 +179,6 @@ void change_blend_mask() {
void disable_blend() {
if (blend_color_mask == SCE_GXM_COLOR_MASK_ALL) {
_change_blend_factor(NULL);
cur_blend_info_ptr = NULL;
if (cur_program != 0) {
reloadCustomShader();
}
@ -163,15 +186,11 @@ void disable_blend() {
change_blend_mask();
}
void vector2f_convert_to_local_space(vector2f *out, int x, int y, int width, int height) {
out[0].x = (float)(2 * x) / (float)DISPLAY_WIDTH_FLOAT - 1.0f;
out[1].x = (float)(2 * (x + width)) / (float)DISPLAY_WIDTH_FLOAT - 1.0f;
out[2].x = (float)(2 * (x + width)) / (float)DISPLAY_WIDTH_FLOAT - 1.0f;
out[3].x = (float)(2 * x) / (float)DISPLAY_WIDTH_FLOAT - 1.0f;
out[0].y = 1.0f - (float)(2 * y) / (float)DISPLAY_HEIGHT_FLOAT;
out[1].y = 1.0f - (float)(2 * y) / (float)DISPLAY_HEIGHT_FLOAT;
out[2].y = 1.0f - (float)(2 * (y + height)) / (float)DISPLAY_HEIGHT_FLOAT;
out[3].y = 1.0f - (float)(2 * (y + height)) / (float)DISPLAY_HEIGHT_FLOAT;
void vector4f_convert_to_local_space(vector4f *out, int x, int y, int width, int height) {
out[0].x = (float)(2 * x) / DISPLAY_WIDTH_FLOAT - 1.0f;
out[0].y = (float)(2 * (x + width)) / DISPLAY_WIDTH_FLOAT - 1.0f;
out[0].z = 1.0f - (float)(2 * y) / DISPLAY_HEIGHT_FLOAT;
out[0].w = 1.0f - (float)(2 * (y + height)) / DISPLAY_HEIGHT_FLOAT;
}
// vitaGL specific functions
@ -180,6 +199,10 @@ void vglUseVram(GLboolean usage) {
use_vram = usage;
}
void vglUseVramForUSSE(GLboolean usage) {
use_vram_for_usse = usage;
}
void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_threshold, SceGxmMultisampleMode msaa) {
// Setting our display size
msaa_mode = msaa;
@ -187,20 +210,23 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
DISPLAY_HEIGHT = height;
DISPLAY_WIDTH_FLOAT = width * 1.0f;
DISPLAY_HEIGHT_FLOAT = height * 1.0f;
switch (DISPLAY_WIDTH) {
case 480:
DISPLAY_STRIDE = 512;
break;
case 640:
DISPLAY_STRIDE = 640;
break;
case 720:
DISPLAY_STRIDE = 768;
break;
default:
DISPLAY_STRIDE = 960;
break;
}
DISPLAY_STRIDE = ALIGN(DISPLAY_WIDTH, 64);
// Adjusting default values for internal viewport
x_port = DISPLAY_WIDTH_FLOAT / 2.0f;
x_scale = x_port;
y_scale = -(DISPLAY_HEIGHT_FLOAT / 2.0f);
y_port = -y_scale;
fullscreen_x_port = x_port;
fullscreen_x_scale = x_scale;
fullscreen_y_port = y_port;
fullscreen_y_scale = y_scale;
// Init viewport state
gl_viewport.x = 0;
gl_viewport.y = 0;
gl_viewport.w = DISPLAY_WIDTH;
gl_viewport.h = DISPLAY_HEIGHT;
// Initializing sceGxm
initGxm();
@ -211,7 +237,7 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
sceKernelGetFreeMemorySize(&info);
// Initializing memory heap for CDRAM and RAM memory
vitagl_mem_init(info.size_user - ram_threshold, info.size_cdram - 1 * 1024 * 1024, info.size_phycont - 1 * 1024 * 1024); // leave some just in case
mem_init(info.size_user > ram_threshold ? info.size_user - ram_threshold : info.size_user, info.size_cdram - 256 * 1024, info.size_phycont - 1 * 1024 * 1024); // leave some just in case
// Initializing sceGxm context
initGxmContext();
@ -255,10 +281,10 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
&disable_color_buffer_fragment_program_patched);
vglMemType type = VGL_MEM_RAM;
clear_vertices = gpu_alloc_mapped(4 * sizeof(vector2f), &type);
clear_vertices = gpu_alloc_mapped(1 * sizeof(vector4f), &type);
depth_clear_indices = gpu_alloc_mapped(4 * sizeof(unsigned short), &type);
vector2f_convert_to_local_space(clear_vertices, 0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT);
vector4f_convert_to_local_space(clear_vertices, 0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT);
depth_clear_indices[0] = 0;
depth_clear_indices[1] = 1;
@ -280,20 +306,8 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
clear_color = sceGxmProgramFindParameterByName(
clear_fragment_program, "u_clear_color");
SceGxmVertexAttribute clear_vertex_attribute;
SceGxmVertexStream clear_vertex_stream;
clear_vertex_attribute.streamIndex = 0;
clear_vertex_attribute.offset = 0;
clear_vertex_attribute.format = SCE_GXM_ATTRIBUTE_FORMAT_F32;
clear_vertex_attribute.componentCount = 2;
clear_vertex_attribute.regIndex = sceGxmProgramParameterGetResourceIndex(
clear_position);
clear_vertex_stream.stride = sizeof(vector2f);
clear_vertex_stream.indexSource = SCE_GXM_INDEX_SOURCE_INDEX_16BIT;
sceGxmShaderPatcherCreateVertexProgram(gxm_shader_patcher,
clear_vertex_id, &clear_vertex_attribute,
1, &clear_vertex_stream, 1, &clear_vertex_program_patched);
clear_vertex_id, NULL, 0, NULL, 0, &clear_vertex_program_patched);
sceGxmShaderPatcherCreateFragmentProgram(gxm_shader_patcher,
clear_fragment_id, SCE_GXM_OUTPUT_REGISTER_FORMAT_UCHAR4,
@ -425,9 +439,6 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
texture2d_fog_color = sceGxmProgramFindParameterByName(
texture2d_fragment_program, "fogColor");
texture2d_fog_mode2 = sceGxmProgramFindParameterByName(
texture2d_vertex_program, "fog_mode");
texture2d_clip_plane0 = sceGxmProgramFindParameterByName(
texture2d_vertex_program, "clip_plane0");
@ -438,13 +449,13 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
texture2d_vertex_program, "modelview");
texture2d_fog_near = sceGxmProgramFindParameterByName(
texture2d_vertex_program, "fog_near");
texture2d_fragment_program, "fog_near");
texture2d_fog_far = sceGxmProgramFindParameterByName(
texture2d_vertex_program, "fog_far");
texture2d_fragment_program, "fog_far");
texture2d_fog_density = sceGxmProgramFindParameterByName(
texture2d_vertex_program, "fog_density");
texture2d_fragment_program, "fog_density");
texture2d_tex_env_color = sceGxmProgramFindParameterByName(
texture2d_fragment_program, "texEnvColor");
@ -509,9 +520,6 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
texture2d_rgba_fog_mode = sceGxmProgramFindParameterByName(
texture2d_rgba_fragment_program, "fog_mode");
texture2d_rgba_fog_mode2 = sceGxmProgramFindParameterByName(
texture2d_rgba_vertex_program, "fog_mode");
texture2d_rgba_clip_plane0 = sceGxmProgramFindParameterByName(
texture2d_rgba_vertex_program, "clip_plane0");
@ -522,13 +530,13 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
texture2d_rgba_vertex_program, "modelview");
texture2d_rgba_fog_near = sceGxmProgramFindParameterByName(
texture2d_rgba_vertex_program, "fog_near");
texture2d_rgba_fragment_program, "fog_near");
texture2d_rgba_fog_far = sceGxmProgramFindParameterByName(
texture2d_rgba_vertex_program, "fog_far");
texture2d_rgba_fragment_program, "fog_far");
texture2d_rgba_fog_density = sceGxmProgramFindParameterByName(
texture2d_rgba_vertex_program, "fog_density");
texture2d_rgba_fragment_program, "fog_density");
texture2d_rgba_fog_color = sceGxmProgramFindParameterByName(
texture2d_rgba_fragment_program, "fogColor");
@ -586,7 +594,7 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
// Scissor Test shader register
sceGxmShaderPatcherCreateMaskUpdateFragmentProgram(gxm_shader_patcher, &scissor_test_fragment_program);
scissor_test_vertices = gpu_alloc_mapped(4 * sizeof(vector2f), &type);
scissor_test_vertices = gpu_alloc_mapped(1 * sizeof(vector4f), &type);
// Allocate temp pool for non-VBO drawing
gpu_pool_init(gpu_pool_size);
@ -615,16 +623,10 @@ void vglInitExtended(uint32_t gpu_pool_size, int width, int height, int ram_thre
buffers[i] = BUFFERS_ADDR + i;
gpu_buffers[i].ptr = NULL;
}
// Init scissor test state
resetScissorTestRegion();
// Init viewport state
gl_viewport.x = 0;
gl_viewport.y = 0;
gl_viewport.w = DISPLAY_WIDTH;
gl_viewport.h = DISPLAY_HEIGHT;
// Getting newlib heap memblock starting address
void *addr = NULL;
sceKernelGetMemBlockBase(_newlib_heap_memblock, &addr);
@ -642,10 +644,10 @@ void vglEnd(void) {
waitRenderingDone();
// Deallocating default vertices buffers
vitagl_mempool_free(clear_vertices, VGL_MEM_RAM);
vitagl_mempool_free(depth_vertices, VGL_MEM_RAM);
vitagl_mempool_free(depth_clear_indices, VGL_MEM_RAM);
vitagl_mempool_free(scissor_test_vertices, VGL_MEM_RAM);
mempool_free(clear_vertices, VGL_MEM_RAM);
mempool_free(depth_vertices, VGL_MEM_RAM);
mempool_free(depth_clear_indices, VGL_MEM_RAM);
mempool_free(scissor_test_vertices, VGL_MEM_RAM);
// Releasing shader programs from sceGxmShaderPatcher
sceGxmShaderPatcherReleaseFragmentProgram(gxm_shader_patcher, scissor_test_fragment_program);
@ -697,7 +699,7 @@ void glGenBuffers(GLsizei n, GLuint *res) {
int i = 0, j = 0;
#ifndef SKIP_ERROR_HANDLING
if (n < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -714,7 +716,7 @@ void glGenBuffers(GLsizei n, GLuint *res) {
void glBindBuffer(GLenum target, GLuint buffer) {
#ifndef SKIP_ERROR_HANDLING
if ((buffer != 0x0000) && ((buffer >= BUFFERS_ADDR + BUFFERS_NUM) || (buffer < BUFFERS_ADDR))) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -726,7 +728,7 @@ void glBindBuffer(GLenum target, GLuint buffer) {
index_array_unit = buffer - BUFFERS_ADDR;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -734,7 +736,7 @@ void glBindBuffer(GLenum target, GLuint buffer) {
void glDeleteBuffers(GLsizei n, const GLuint *gl_buffers) {
#ifndef SKIP_ERROR_HANDLING
if (n < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -744,7 +746,7 @@ void glDeleteBuffers(GLsizei n, const GLuint *gl_buffers) {
uint8_t idx = gl_buffers[j] - BUFFERS_ADDR;
buffers[idx] = gl_buffers[j];
if (gpu_buffers[idx].ptr != NULL) {
vitagl_mempool_free(gpu_buffers[idx].ptr, VGL_MEM_VRAM);
mempool_free(gpu_buffers[idx].ptr, VGL_MEM_VRAM);
gpu_buffers[idx].ptr = NULL;
}
}
@ -754,7 +756,7 @@ void glDeleteBuffers(GLsizei n, const GLuint *gl_buffers) {
void glBufferData(GLenum target, GLsizei size, const GLvoid *data, GLenum usage) {
#ifndef SKIP_ERROR_HANDLING
if (size < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -767,7 +769,7 @@ void glBufferData(GLenum target, GLsizei size, const GLvoid *data, GLenum usage)
idx = index_array_unit;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
vglMemType type = VGL_MEM_VRAM;
@ -811,7 +813,7 @@ void glBlendFunc(GLenum sfactor, GLenum dfactor) {
blend_sfactor_rgb = blend_sfactor_a = SCE_GXM_BLEND_FACTOR_SRC_ALPHA_SATURATE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
switch (dfactor) {
@ -849,7 +851,7 @@ void glBlendFunc(GLenum sfactor, GLenum dfactor) {
blend_dfactor_rgb = blend_dfactor_a = SCE_GXM_BLEND_FACTOR_SRC_ALPHA_SATURATE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
if (blend_state)
@ -892,7 +894,7 @@ void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum d
blend_sfactor_rgb = SCE_GXM_BLEND_FACTOR_SRC_ALPHA_SATURATE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
switch (dstRGB) {
@ -930,7 +932,7 @@ void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum d
blend_dfactor_rgb = SCE_GXM_BLEND_FACTOR_SRC_ALPHA_SATURATE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
switch (srcAlpha) {
@ -968,7 +970,7 @@ void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum d
blend_sfactor_a = SCE_GXM_BLEND_FACTOR_SRC_ALPHA_SATURATE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
switch (dstAlpha) {
@ -1006,7 +1008,7 @@ void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum d
blend_dfactor_a = SCE_GXM_BLEND_FACTOR_SRC_ALPHA_SATURATE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
if (blend_state)
@ -1031,7 +1033,7 @@ void glBlendEquation(GLenum mode) {
blend_func_rgb = blend_func_a = SCE_GXM_BLEND_FUNC_MAX;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
if (blend_state)
@ -1056,7 +1058,7 @@ void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
blend_func_rgb = SCE_GXM_BLEND_FUNC_MAX;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
switch (modeAlpha) {
@ -1076,7 +1078,7 @@ void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
blend_func_a = SCE_GXM_BLEND_FUNC_MAX;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
if (blend_state)
@ -1101,8 +1103,8 @@ void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha
void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
#ifndef SKIP_ERROR_HANDLING
if ((stride < 0) || ((size < 2) && (size > 4))) {
_vitagl_error = GL_INVALID_VALUE;
if ((stride < 0) || (size < 2) || (size > 4)) {
error = GL_INVALID_VALUE;
return;
}
#endif
@ -1115,7 +1117,7 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *poin
tex_unit->vertex_array.size = sizeof(GLshort);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
@ -1126,8 +1128,8 @@ void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *poin
void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
#ifndef SKIP_ERROR_HANDLING
if ((stride < 0) || ((size < 3) && (size > 4))) {
_vitagl_error = GL_INVALID_VALUE;
if ((stride < 0) || (size < 3) || (size > 4)) {
error = GL_INVALID_VALUE;
return;
}
#endif
@ -1140,7 +1142,7 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *point
tex_unit->color_array.size = sizeof(GLshort);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
@ -1151,8 +1153,8 @@ void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *point
void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
#ifndef SKIP_ERROR_HANDLING
if ((stride < 0) || ((size < 2) && (size > 4))) {
_vitagl_error = GL_INVALID_VALUE;
if ((stride < 0) || (size < 2) || (size > 4)) {
error = GL_INVALID_VALUE;
return;
}
#endif
@ -1165,7 +1167,7 @@ void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *po
tex_unit->texture_array.size = sizeof(GLshort);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
@ -1178,8 +1180,8 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
texture_unit *tex_unit = &texture_units[client_texture_unit];
int texture2d_idx = tex_unit->tex_id;
SceGxmPrimitiveType gxm_p;
GLboolean skip_draw = GL_FALSE;
if (tex_unit->vertex_array_state) {
GLboolean skip_draw = GL_FALSE;
switch (mode) {
case GL_POINTS:
gxm_p = SCE_GXM_PRIMITIVE_POINTS;
@ -1207,7 +1209,7 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
skip_draw = GL_TRUE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
if (!skip_draw) {
@ -1233,6 +1235,9 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_mode, 0, 1, &fogmode);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_color, 0, 4, &fog_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_tex_env_color, 0, 4, &texenv_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_density, 0, 1, (const float *)&fog_density);
} else {
sceGxmSetVertexProgram(gxm_context, texture2d_vertex_program_patched);
sceGxmSetFragmentProgram(gxm_context, texture2d_fragment_program_patched);
@ -1248,6 +1253,9 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_mode, 0, 1, &fogmode);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_color, 0, 4, &fog_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_tex_env_color, 0, 4, &texenv_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_density, 0, 1, (const float *)&fog_density);
}
} else if (tex_unit->color_array_state && (tex_unit->color_array.num == 3)) {
sceGxmSetVertexProgram(gxm_context, rgb_vertex_program_patched);
@ -1261,27 +1269,18 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_wvp_buffer);
if (tex_unit->texture_array_state) {
float fogmode = (float)internal_fog_mode;
if (tex_unit->color_array_state) {
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_wvp, 0, 16, (const float *)mvp_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_mode, 0, 1, (const float *)&fogmode);
float clipplane0 = (float)clip_plane0;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_clip_plane0, 0, 1, &clipplane0);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_clip_plane0_eq, 0, 4, &clip_plane0_eq.x);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_mv, 0, 16, (const float *)modelview_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_density, 0, 1, (const float *)&fog_density);
} else {
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_wvp, 0, 16, (const float *)mvp_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_mode2, 0, 1, (const float *)&fogmode);
float clipplane0 = (float)clip_plane0;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0, 0, 1, &clipplane0);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0_eq, 0, 4, &clip_plane0_eq.x);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_mv, 0, 16, (const float *)modelview_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_density, 0, 1, (const float *)&fog_density);
}
sceGxmSetFragmentTexture(gxm_context, 0, &tex_unit->textures[texture2d_idx].gxm_tex);
vector3f *vertices = NULL;
@ -1320,20 +1319,20 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
uint8_t vec_set = 0, tex_set = 0, clr_set = 0;
if (tex_unit->vertex_array.stride == 0) {
ptr = ((uint8_t *)tex_unit->vertex_array.pointer) + (first * (tex_unit->vertex_array.num * tex_unit->vertex_array.size));
memcpy(&vertices[n], ptr, count * sizeof(vector3f));
memcpy(&vertices[0], ptr, count * sizeof(vector3f));
vec_set = 1;
} else
ptr = ((uint8_t *)tex_unit->vertex_array.pointer) + (first * tex_unit->vertex_array.stride);
if (tex_unit->texture_array.stride == 0) {
ptr_tex = ((uint8_t *)tex_unit->texture_array.pointer) + (first * (tex_unit->texture_array.num * tex_unit->texture_array.size));
memcpy(&uv_map[n], ptr_tex, count * sizeof(vector2f));
memcpy(&uv_map[0], ptr_tex, count * sizeof(vector2f));
tex_set = 1;
} else
ptr_tex = ((uint8_t *)tex_unit->texture_array.pointer) + (first * tex_unit->texture_array.stride);
if (tex_unit->color_array_state) {
if (tex_unit->color_array.stride == 0) {
ptr_clr = ((uint8_t *)tex_unit->color_array.pointer) + (first * sizeof(vector4f));
memcpy(&colors[n], ptr_clr, count * sizeof(vector4f));
memcpy(&colors[0], ptr_clr, count * sizeof(vector4f));
clr_set = 1;
} else
ptr_clr = ((uint8_t *)tex_unit->color_array.pointer) + (first * tex_unit->color_array.stride);
@ -1466,18 +1465,17 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *gl_indices) {
SceGxmPrimitiveType gxm_p;
SceGxmPrimitiveTypeExtra gxm_ep = SCE_GXM_PRIMITIVE_NONE;
texture_unit *tex_unit = &texture_units[client_texture_unit];
int texture2d_idx = tex_unit->tex_id;
GLboolean skip_draw = GL_FALSE;
if (tex_unit->vertex_array_state) {
GLboolean skip_draw = GL_FALSE;
#ifndef SKIP_ERROR_HANDLING
if (type != GL_UNSIGNED_SHORT)
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
else if (phase == MODEL_CREATION)
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
else if (count < 0)
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
#endif
switch (mode) {
case GL_POINTS:
@ -1502,7 +1500,7 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *gl_in
skip_draw = GL_TRUE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
if (!skip_draw) {
@ -1528,6 +1526,9 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *gl_in
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_mode, 0, 1, &fogmode);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_color, 0, 4, &fog_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_tex_env_color, 0, 4, &texenv_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_density, 0, 1, (const float *)&fog_density);
} else {
sceGxmSetVertexProgram(gxm_context, texture2d_vertex_program_patched);
sceGxmSetFragmentProgram(gxm_context, texture2d_fragment_program_patched);
@ -1543,6 +1544,9 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *gl_in
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_mode, 0, 1, &fogmode);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_color, 0, 4, &fog_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_tex_env_color, 0, 4, &texenv_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_density, 0, 1, (const float *)&fog_density);
}
} else if (tex_unit->color_array_state && (tex_unit->color_array.num == 3)) {
sceGxmSetVertexProgram(gxm_context, rgb_vertex_program_patched);
@ -1556,27 +1560,18 @@ void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *gl_in
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_wvp_buffer);
if (tex_unit->texture_array_state) {
float fogmode = (float)internal_fog_mode;
if (tex_unit->color_array_state) {
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_wvp, 0, 16, (const float *)mvp_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_mode, 0, 1, (const float *)&fogmode);
float clipplane0 = (float)clip_plane0;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_clip_plane0, 0, 1, &clipplane0);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_clip_plane0_eq, 0, 4, &clip_plane0_eq.x);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_mv, 0, 16, (const float *)modelview_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_density, 0, 1, (const float *)&fog_density);
} else {
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_wvp, 0, 16, (const float *)mvp_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_mode2, 0, 1, (const float *)&fogmode);
float clipplane0 = (float)clip_plane0;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0, 0, 1, &clipplane0);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0_eq, 0, 4, &clip_plane0_eq.x);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_mv, 0, 16, (const float *)modelview_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_density, 0, 1, (const float *)&fog_density);
}
sceGxmSetFragmentTexture(gxm_context, 0, &texture_units[client_texture_unit].textures[texture2d_idx].gxm_tex);
vector3f *vertices = NULL;
@ -1739,7 +1734,7 @@ void glEnableClientState(GLenum array) {
tex_unit->texture_array_state = GL_TRUE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -1757,7 +1752,7 @@ void glDisableClientState(GLenum array) {
tex_unit->texture_array_state = GL_FALSE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
}
@ -1765,7 +1760,7 @@ void glDisableClientState(GLenum array) {
void glClientActiveTexture(GLenum texture) {
#ifndef SKIP_ERROR_HANDLING
if ((texture < GL_TEXTURE0) && (texture > GL_TEXTURE31))
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
else
#endif
client_texture_unit = texture - GL_TEXTURE0;
@ -1775,8 +1770,8 @@ void glClientActiveTexture(GLenum texture) {
void vglVertexPointer(GLint size, GLenum type, GLsizei stride, GLuint count, const GLvoid *pointer) {
#ifndef SKIP_ERROR_HANDLING
if ((stride < 0) || ((size < 2) && (size > 4))) {
_vitagl_error = GL_INVALID_VALUE;
if ((stride < 0) || (size < 2) || (size > 4)) {
error = GL_INVALID_VALUE;
return;
}
#endif
@ -1790,7 +1785,7 @@ void vglVertexPointer(GLint size, GLenum type, GLsizei stride, GLuint count, con
bpe = sizeof(GLshort);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
tex_unit->vertex_object = gpu_pool_memalign(count * bpe * size, bpe * size);
@ -1810,8 +1805,8 @@ void vglVertexPointer(GLint size, GLenum type, GLsizei stride, GLuint count, con
void vglColorPointer(GLint size, GLenum type, GLsizei stride, GLuint count, const GLvoid *pointer) {
#ifndef SKIP_ERROR_HANDLING
if ((stride < 0) || ((size < 3) && (size > 4))) {
_vitagl_error = GL_INVALID_VALUE;
if ((stride < 0) || (size < 3) || (size > 4)) {
error = GL_INVALID_VALUE;
return;
}
#endif
@ -1828,7 +1823,7 @@ void vglColorPointer(GLint size, GLenum type, GLsizei stride, GLuint count, cons
bpe = sizeof(uint8_t);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
tex_unit->color_object = gpu_pool_memalign(count * bpe * size, bpe * size);
@ -1849,8 +1844,8 @@ void vglColorPointer(GLint size, GLenum type, GLsizei stride, GLuint count, cons
void vglTexCoordPointer(GLint size, GLenum type, GLsizei stride, GLuint count, const GLvoid *pointer) {
#ifndef SKIP_ERROR_HANDLING
if ((stride < 0) || ((size < 2) && (size > 4))) {
_vitagl_error = GL_INVALID_VALUE;
if ((stride < 0) || (size < 2) || (size > 4)) {
error = GL_INVALID_VALUE;
return;
}
#endif
@ -1864,7 +1859,7 @@ void vglTexCoordPointer(GLint size, GLenum type, GLsizei stride, GLuint count, c
bpe = sizeof(GLshort);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
tex_unit->texture_object = gpu_pool_memalign(count * bpe * size, bpe * size);
@ -1885,7 +1880,7 @@ void vglTexCoordPointer(GLint size, GLenum type, GLsizei stride, GLuint count, c
void vglIndexPointer(GLenum type, GLsizei stride, GLuint count, const GLvoid *pointer) {
#ifndef SKIP_ERROR_HANDLING
if (stride < 0) {
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
return;
}
#endif
@ -1899,7 +1894,7 @@ void vglIndexPointer(GLenum type, GLsizei stride, GLuint count, const GLvoid *po
bpe = sizeof(GLshort);
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
tex_unit->index_object = gpu_pool_memalign(count * bpe, bpe);
@ -1944,9 +1939,9 @@ void vglDrawObjects(GLenum mode, GLsizei count, GLboolean implicit_wvp) {
int texture2d_idx = tex_unit->tex_id;
#ifndef SKIP_ERROR_HANDLING
if (phase == MODEL_CREATION)
_vitagl_error = GL_INVALID_OPERATION;
error = GL_INVALID_OPERATION;
else if (count < 0)
_vitagl_error = GL_INVALID_VALUE;
error = GL_INVALID_VALUE;
#endif
GLboolean skip_draw = GL_FALSE;
switch (mode) {
@ -1972,7 +1967,7 @@ void vglDrawObjects(GLenum mode, GLsizei count, GLboolean implicit_wvp) {
skip_draw = GL_TRUE;
break;
default:
_vitagl_error = GL_INVALID_ENUM;
error = GL_INVALID_ENUM;
break;
}
if (!skip_draw) {
@ -2008,6 +2003,9 @@ void vglDrawObjects(GLenum mode, GLsizei count, GLboolean implicit_wvp) {
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_mode, 0, 1, &fogmode);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_color, 0, 4, &fog_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_tex_env_color, 0, 4, &texenv_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(alpha_buffer, texture2d_rgba_fog_density, 0, 1, (const float *)&fog_density);
} else {
sceGxmSetVertexProgram(gxm_context, texture2d_vertex_program_patched);
sceGxmSetFragmentProgram(gxm_context, texture2d_fragment_program_patched);
@ -2024,6 +2022,9 @@ void vglDrawObjects(GLenum mode, GLsizei count, GLboolean implicit_wvp) {
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_color, 0, 4, &fog_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_tint_color, 0, 4, &current_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_tex_env_color, 0, 4, &texenv_color.r);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(alpha_buffer, texture2d_fog_density, 0, 1, (const float *)&fog_density);
}
} else if (tex_unit->color_array_state && (tex_unit->color_array.num == 3)) {
if (tex_unit->color_object_type == GL_FLOAT)
@ -2041,27 +2042,18 @@ void vglDrawObjects(GLenum mode, GLsizei count, GLboolean implicit_wvp) {
void *vertex_wvp_buffer;
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &vertex_wvp_buffer);
if (tex_unit->texture_array_state) {
float fogmode = (float)internal_fog_mode;
if (tex_unit->color_array_state) {
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_wvp, 0, 16, (const float *)mvp_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_mode2, 0, 1, (const float *)&fogmode);
float clipplane0 = (float)clip_plane0;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_clip_plane0, 0, 1, &clipplane0);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_clip_plane0_eq, 0, 4, &clip_plane0_eq.x);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_mv, 0, 16, (const float *)modelview_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_rgba_fog_density, 0, 1, (const float *)&fog_density);
} else {
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_wvp, 0, 16, (const float *)mvp_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_mode2, 0, 1, (const float *)&fogmode);
float clipplane0 = (float)clip_plane0;
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0, 0, 1, &clipplane0);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_clip_plane0_eq, 0, 4, &clip_plane0_eq.x);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_mv, 0, 16, (const float *)modelview_matrix);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_near, 0, 1, (const float *)&fog_near);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_far, 0, 1, (const float *)&fog_far);
sceGxmSetUniformDataF(vertex_wvp_buffer, texture2d_fog_density, 0, 1, (const float *)&fog_density);
}
sceGxmSetFragmentTexture(gxm_context, 0, &tex_unit->textures[texture2d_idx].gxm_tex);
sceGxmSetVertexStream(gxm_context, 0, tex_unit->vertex_object);
@ -2096,15 +2088,19 @@ void vglDrawObjects(GLenum mode, GLsizei count, GLboolean implicit_wvp) {
size_t vglMemFree(vglMemType type) {
if (type >= VGL_MEM_TYPE_COUNT)
return 0;
return vitagl_mempool_get_free_space(type);
return mempool_get_free_space(type);
}
void *vglAlloc(uint32_t size, vglMemType type) {
if (type >= VGL_MEM_TYPE_COUNT)
return NULL;
return vitagl_mempool_alloc(size, type);
return mempool_alloc(size, type);
}
void vglFree(void *addr) {
vitagl_mempool_free(addr, VGL_MEM_RAM); // Type is discarded so we just pass a random one
mempool_free(addr, VGL_MEM_RAM); // Type is discarded so we just pass a random one
}
void vglUseExtraMem(GLboolean use) {
use_extra_mem = use;
}

View File

@ -1,3 +1,21 @@
/*
* This file is part of vitaGL
* Copyright 2017, 2018, 2019, 2020 Rinnegatamante
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _VITAGL_H_
#define _VITAGL_H_
@ -81,6 +99,7 @@ extern "C" {
#define GL_STENCIL_TEST 0x0B90
#define GL_VIEWPORT 0x0BA2
#define GL_MODELVIEW_MATRIX 0x0BA6
#define GL_PROJECTION_MATRIX 0x0BA7
#define GL_ALPHA_TEST 0x0BC0
#define GL_BLEND 0x0BE2
#define GL_SCISSOR_BOX 0x0C10
@ -163,6 +182,9 @@ extern "C" {
#define GL_RG 0x8227
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#define GL_MIRRORED_REPEAT 0x8370
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
@ -197,6 +219,7 @@ extern "C" {
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
#define GL_INCR_WRAP 0x8507
#define GL_MIRROR_CLAMP_EXT 0x8742
#define GL_DECR_WRAP 0x8508
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
@ -218,6 +241,9 @@ extern "C" {
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 32
// Aliases
#define GL_CLAMP GL_CLAMP_TO_EDGE
typedef enum GLbitfield{
GL_DEPTH_BUFFER_BIT = 0x00000100,
GL_STENCIL_BUFFER_BIT = 0x00000400,
@ -321,6 +347,7 @@ void glTexCoord2fv(GLfloat *f);
void glTexCoord2i(GLint s, GLint t);
void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void glTexEnvf(GLenum target, GLenum pname, GLfloat param);
void glTexEnvfv(GLenum target, GLenum pname, GLfloat *param);
void glTexEnvi(GLenum target, GLenum pname, GLint param);
void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *data);
void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
@ -377,6 +404,8 @@ void vglStopRenderingInit();
void vglStopRenderingTerm();
void vglUpdateCommonDialog();
void vglUseVram(GLboolean usage);
void vglUseVramForUSSE(GLboolean usage);
void vglUseExtraMem(GLboolean usage);
void vglWaitVblankStart(GLboolean enable);
#ifdef __cplusplus

View File

@ -112,6 +112,8 @@ static void gfx_display_gl1_draw(gfx_display_ctx_draw_t *draw,
draw->coords->tex_coord = gfx_display_gl1_get_default_tex_coords();
if (!draw->coords->lut_tex_coord)
draw->coords->lut_tex_coord = gfx_display_gl1_get_default_tex_coords();
if (!draw->texture)
return;
gfx_display_gl1_viewport(draw, gl1);
@ -146,7 +148,6 @@ static void gfx_display_gl1_draw(gfx_display_ctx_draw_t *draw,
for (i = 0; i < draw->coords->vertices; i++)
{
memcpy(&vertices3[i*3], &draw->coords->vertex[i*2], sizeof(float) * 2);
vertices3[i*3] -= 0.5f;
vertices3[i*3+2] = 0.0f;
}
glVertexPointer(3, GL_FLOAT, 0, vertices3);

View File

@ -273,7 +273,6 @@ static void gl1_raster_font_draw_vertices(gl1_raster_t *font,
int i;
for (i = 0; i < coords->vertices; i++) {
memcpy(&vertices3[i*3], &coords->vertex[i*2], sizeof(float) * 2);
vertices3[i*3] -= 0.5f;
vertices3[i*3+2] = 0.0f;
}
glVertexPointer(3, GL_FLOAT, 0, vertices3);