├── .gitignore
├── CMakeLists.txt
├── LICENSE.txt
├── README.md
├── cmake
└── Modules
│ ├── FindGLES.cmake
│ ├── RequireFunctionExists.cmake
│ └── RequireIncludeFile.cmake
├── libs
└── gles
│ ├── bin
│ ├── libEGL.dll
│ ├── libGLES_CM.dll
│ └── libGLESv2.dll
│ ├── include
│ ├── CL
│ │ ├── cl.h
│ │ ├── cl_d3d10.h
│ │ ├── cl_d3d11.h
│ │ ├── cl_dx9_media_sharing.h
│ │ ├── cl_egl.h
│ │ ├── cl_ext.h
│ │ ├── cl_gl.h
│ │ ├── cl_gl_ext.h
│ │ ├── cl_platform.h
│ │ └── opencl.h
│ ├── DynamicEgl.h
│ ├── DynamicGles.h
│ ├── DynamicOCL.h
│ ├── EGL
│ │ ├── egl.h
│ │ ├── eglext.h
│ │ └── eglplatform.h
│ ├── GLES
│ │ ├── egl.h
│ │ ├── gl.h
│ │ ├── glext.h
│ │ └── glplatform.h
│ ├── GLES2
│ │ ├── gl2.h
│ │ ├── gl2ext.h
│ │ └── gl2platform.h
│ ├── GLES3
│ │ ├── gl3.h
│ │ ├── gl31.h
│ │ ├── gl32.h
│ │ └── gl3platform.h
│ ├── KHR
│ │ └── khrplatform.h
│ ├── PVRScopeComms.h
│ ├── PVRScopeStats.h
│ ├── pvr_openlib.h
│ ├── sdkver.h
│ ├── vk_bindings.h
│ ├── vk_bindings_helper.h
│ └── vulkan
│ │ ├── vk_icd.h
│ │ ├── vk_layer.h
│ │ ├── vk_platform.h
│ │ ├── vk_sdk_platform.h
│ │ ├── vulkan.h
│ │ ├── vulkan_android.h
│ │ ├── vulkan_core.h
│ │ ├── vulkan_fuchsia.h
│ │ ├── vulkan_ggp.h
│ │ ├── vulkan_ios.h
│ │ ├── vulkan_macos.h
│ │ ├── vulkan_metal.h
│ │ ├── vulkan_vi.h
│ │ ├── vulkan_wayland.h
│ │ ├── vulkan_win32.h
│ │ ├── vulkan_xcb.h
│ │ ├── vulkan_xlib.h
│ │ └── vulkan_xlib_xrandr.h
│ └── lib
│ ├── libEGL.lib
│ ├── libGLES_CM.lib
│ └── libGLESv2.lib
├── samples
├── CMakeLists.txt
├── Common
│ ├── CMakeLists.txt
│ ├── Include
│ │ ├── es_util.h
│ │ ├── es_util_win.h
│ │ ├── stb_image.h
│ │ ├── stb_image_write.h
│ │ └── stb_truetype.h
│ └── Source
│ │ ├── es_util.cpp
│ │ └── es_util_win32.cpp
└── Hello_Font
│ ├── CMakeLists.txt
│ ├── DroidSerif-Bold.ttf
│ ├── DroidSerif-Italic.ttf
│ ├── DroidSerif-Regular.ttf
│ ├── Hello_Font.cpp
│ ├── SourceHanSansCN-Normal.otf
│ └── tiny_font
│ ├── tiny_font_stash.cpp
│ ├── tiny_font_stash.h
│ ├── tiny_fontstashcallbacks.cpp
│ ├── tiny_fontstashcallbacks.h
│ ├── tiny_load_shader.cpp
│ ├── tiny_load_shader.h
│ ├── tiny_opengl_include.h
│ ├── tiny_primitive_renderer.cpp
│ └── tiny_primitive_renderer.h
└── screenshot.png
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | cmake-build-debug/
3 |
4 | .idea/
5 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2 | set(CMAKE_MODULE_PATH
3 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
4 | "${CMAKE_MODULE_PATH}")
5 | set(GLES_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/gles)
6 | find_package(GLES REQUIRED)
7 |
8 | include_directories(
9 | ${GLES_INCLUDE_PATH}
10 | ${CMAKE_CURRENT_SOURCE_DIR}
11 | )
12 | if (MSVC)
13 | if (CMAKE_BUILD_TYPE STREQUAL "Debug")
14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
15 | else ()
16 | set(CMAKE_BUILD_TYPE "Release")
17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /Gy /Oi /Oy /O2 /Ot /Zi /EHsc ")
18 | endif ()
19 | ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
20 | else ()
21 | if (CMAKE_BUILD_TYPE STREQUAL "Debug")
22 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -Wno-unused-variable")
23 | else (CMAKE_BUILD_TYPE STREQUAL "Debug")
24 | set(CMAKE_BUILD_TYPE "Release")
25 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")
26 | endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
27 | endif ()
28 |
29 |
30 | add_subdirectory(samples)
31 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TinyText
2 | Text Rendering Module Port From [Tiny Differentiable Simulator](https://github.com/google-research/tiny-differentiable-simulator/) For Win64
3 |
4 | 
5 |
6 | ## Donating
7 | If you found this project useful, consider buying me a coffee
8 |
9 |
10 |
--------------------------------------------------------------------------------
/cmake/Modules/FindGLES.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Try to find GLES SDK library and include path.
3 | # Once done this will define
4 | #
5 | # GLES_FOUND
6 | # GLES_INCLUDE_PATH
7 | # GLES_LIBRARY
8 |
9 | IF (WIN32)
10 | FIND_PATH(GLES_INCLUDE_PATH pvr_openlib.h
11 | ${GLES_ROOT_DIR}/include
12 | /usr/include
13 | /usr/local/include
14 | /sw/include
15 | /opt/local/include
16 | DOC "The directory where pvr_openlib.h resides")
17 | # Prefer the static library.
18 | FIND_LIBRARY(EGL_LIBRARY
19 | NAMES libEGL.lib
20 | PATHS
21 | ${GLES_ROOT_DIR}/lib
22 | /usr/lib64
23 | /usr/lib
24 | /usr/local/lib64
25 | /usr/local/lib
26 | /sw/lib
27 | /opt/local/lib
28 | DOC "The EGL static library")
29 | FIND_LIBRARY(GLES_CM_LIBRARY
30 | NAMES libGLES_CM.lib libGLESv2.lib
31 | PATHS
32 | ${GLES_ROOT_DIR}/lib
33 | /usr/lib64
34 | /usr/lib
35 | /usr/local/lib64
36 | /usr/local/lib
37 | /sw/lib
38 | /opt/local/lib
39 | DOC "The libGLES_CM static library")
40 | FIND_LIBRARY(GLES_LIBRARY
41 | NAMES libGLESv2.lib
42 | PATHS
43 | ${GLES_ROOT_DIR}/lib
44 | /usr/lib64
45 | /usr/lib
46 | /usr/local/lib64
47 | /usr/local/lib
48 | /sw/lib
49 | /opt/local/lib
50 | DOC "The GLES static library")
51 | ELSE (WIN32)
52 | FIND_PATH(GLES_INCLUDE_PATH pvr_openlib.h
53 | ${GLES_ROOT_DIR}/include
54 | $ENV{PROGRAMFILES}/GLES/include
55 | DOC "The directory where pvr_openlib.h resides")
56 | FIND_LIBRARY(EGL_LIBRARY
57 | NAMES libEGL
58 | PATHS
59 | ${GLES_ROOT_DIR}/bin
60 | DOC "The EGL library")
61 | FIND_LIBRARY(GLES_CM_LIBRARY
62 | NAMES libGLES_CM
63 | PATHS
64 | ${GLES_ROOT_DIR}/bin
65 | DOC "The libGLES_CM library")
66 | FIND_LIBRARY(GLES_LIBRARY
67 | NAMES libGLESv2
68 | PATHS
69 | ${GLES_ROOT_DIR}/bin
70 | DOC "The GLES library")
71 | ENDIF (WIN32)
72 |
73 | SET(GLES_FOUND "NO")
74 | IF (GLES_INCLUDE_PATH AND GLES_LIBRARY AND GLES_CM_LIBRARY AND EGL_LIBRARY)
75 | SET(GLES_LIBRARIES ${GLES_LIBRARY} ${GLES_CM_LIBRARY} ${EGL_LIBRARY})
76 | SET(GLES_FOUND "YES")
77 | message(STATUS "GLES LIBRARIES FOUND")
78 | ENDIF (GLES_INCLUDE_PATH AND GLES_LIBRARY AND GLES_CM_LIBRARY AND EGL_LIBRARY)
79 | # message(STATUS "GLES LIBRARIES is ${GLES_LIBRARIES}")
80 | INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
81 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLES DEFAULT_MSG GLES_LIBRARIES)
82 |
--------------------------------------------------------------------------------
/cmake/Modules/RequireFunctionExists.cmake:
--------------------------------------------------------------------------------
1 | #.rst:
2 | # RequireFunctionExists
3 | # ---------------------
4 | #
5 | # Require that a C function can be linked
6 | #
7 | # REQUIRE_FUNCTION_EXISTS( )
8 | #
9 | # Uses check_function_exists internally and aborts the configure process with a
10 | # Fatal error when the function can not be linked.
11 | #
12 | # See the :module:`CheckFunctionExists` module for more details.
13 |
14 | include(CheckFunctionExists)
15 |
16 | macro(REQUIRE_FUNCTION_EXISTS FUNCTION_NAME VARIABLE)
17 | check_function_exists(${FUNCTION_NAME} ${VARIABLE})
18 |
19 | if (NOT ${VARIABLE})
20 | message(FATAL_ERROR "Required `${FUNCTION_NAME}` could not be linked")
21 | endif ()
22 | endmacro()
23 |
--------------------------------------------------------------------------------
/cmake/Modules/RequireIncludeFile.cmake:
--------------------------------------------------------------------------------
1 | #.rst:
2 | # RequireIncludeFile
3 | # ------------------
4 | #
5 | # Provides a macro to require the existence of a ``C`` header.
6 | #
7 | # .. command:: REQUIRE_INCLUDE_FILE
8 | #
9 | # ::
10 | #
11 | # REQUIRE_INCLUDE_FILE( VARIABLE [])
12 | #
13 | # Uses check_include_file internally and aborts the configure process with a
14 | # Fatal error when the header was not found.
15 | #
16 | # See the :module:`CheckIncludeFile` module for more details.
17 |
18 | include(CheckIncludeFile)
19 |
20 | macro(REQUIRE_INCLUDE_FILE INCLUDE_FILE VARIABLE)
21 | if (${ARGC} EQUAL 3)
22 | check_include_file(${INCLUDE_FILE} ${VARIABLE} ${ARGV2})
23 | else ()
24 | check_include_file(${INCLUDE_FILE} ${VARIABLE})
25 | endif ()
26 |
27 | if (NOT ${VARIABLE})
28 | message(FATAL_ERROR "Required `${INCLUDE_FILE}` include file not found")
29 | endif ()
30 | endmacro()
31 |
--------------------------------------------------------------------------------
/libs/gles/bin/libEGL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/libs/gles/bin/libEGL.dll
--------------------------------------------------------------------------------
/libs/gles/bin/libGLES_CM.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/libs/gles/bin/libGLES_CM.dll
--------------------------------------------------------------------------------
/libs/gles/bin/libGLESv2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/libs/gles/bin/libGLESv2.dll
--------------------------------------------------------------------------------
/libs/gles/include/CL/cl_d3d10.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************
2 | * Copyright (c) 2008-2015 The Khronos Group Inc.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and/or associated documentation files (the
6 | * "Materials"), to deal in the Materials without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Materials, and to
9 | * permit persons to whom the Materials are furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included
13 | * in all copies or substantial portions of the Materials.
14 | *
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 | * https://www.khronos.org/registry/
19 | *
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 | **********************************************************************************/
28 |
29 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
30 |
31 | #ifndef __OPENCL_CL_D3D10_H
32 | #define __OPENCL_CL_D3D10_H
33 |
34 | #include
35 | #include
36 | #include
37 |
38 | #ifdef __cplusplus
39 | extern "C" {
40 | #endif
41 |
42 | /******************************************************************************
43 | * cl_khr_d3d10_sharing */
44 | #define cl_khr_d3d10_sharing 1
45 |
46 | typedef cl_uint cl_d3d10_device_source_khr;
47 | typedef cl_uint cl_d3d10_device_set_khr;
48 |
49 | /******************************************************************************/
50 |
51 | /* Error Codes */
52 | #define CL_INVALID_D3D10_DEVICE_KHR -1002
53 | #define CL_INVALID_D3D10_RESOURCE_KHR -1003
54 | #define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004
55 | #define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005
56 |
57 | /* cl_d3d10_device_source_nv */
58 | #define CL_D3D10_DEVICE_KHR 0x4010
59 | #define CL_D3D10_DXGI_ADAPTER_KHR 0x4011
60 |
61 | /* cl_d3d10_device_set_nv */
62 | #define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012
63 | #define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013
64 |
65 | /* cl_context_info */
66 | #define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
67 | #define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
68 |
69 | /* cl_mem_info */
70 | #define CL_MEM_D3D10_RESOURCE_KHR 0x4015
71 |
72 | /* cl_image_info */
73 | #define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016
74 |
75 | /* cl_command_type */
76 | #define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017
77 | #define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
78 |
79 | /******************************************************************************/
80 |
81 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
82 | cl_platform_id platform,
83 | cl_d3d10_device_source_khr d3d_device_source,
84 | void *d3d_object,
85 | cl_d3d10_device_set_khr d3d_device_set,
86 | cl_uint num_entries,
87 | cl_device_id *devices,
88 | cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0;
89 |
90 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
91 | cl_context context,
92 | cl_mem_flags flags,
93 | ID3D10Buffer *resource,
94 | cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
95 |
96 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
97 | cl_context context,
98 | cl_mem_flags flags,
99 | ID3D10Texture2D *resource,
100 | UINT subresource,
101 | cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
102 |
103 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
104 | cl_context context,
105 | cl_mem_flags flags,
106 | ID3D10Texture3D *resource,
107 | UINT subresource,
108 | cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
109 |
110 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)(
111 | cl_command_queue command_queue,
112 | cl_uint num_objects,
113 | const cl_mem *mem_objects,
114 | cl_uint num_events_in_wait_list,
115 | const cl_event *event_wait_list,
116 | cl_event *event) CL_API_SUFFIX__VERSION_1_0;
117 |
118 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
119 | cl_command_queue command_queue,
120 | cl_uint num_objects,
121 | const cl_mem *mem_objects,
122 | cl_uint num_events_in_wait_list,
123 | const cl_event *event_wait_list,
124 | cl_event *event) CL_API_SUFFIX__VERSION_1_0;
125 |
126 | #ifdef __cplusplus
127 | }
128 | #endif
129 |
130 | #endif /* __OPENCL_CL_D3D10_H */
131 |
132 |
--------------------------------------------------------------------------------
/libs/gles/include/CL/cl_d3d11.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************
2 | * Copyright (c) 2008-2015 The Khronos Group Inc.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and/or associated documentation files (the
6 | * "Materials"), to deal in the Materials without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Materials, and to
9 | * permit persons to whom the Materials are furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included
13 | * in all copies or substantial portions of the Materials.
14 | *
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 | * https://www.khronos.org/registry/
19 | *
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 | **********************************************************************************/
28 |
29 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
30 |
31 | #ifndef __OPENCL_CL_D3D11_H
32 | #define __OPENCL_CL_D3D11_H
33 |
34 | #include
35 | #include
36 | #include
37 |
38 | #ifdef __cplusplus
39 | extern "C" {
40 | #endif
41 |
42 | /******************************************************************************
43 | * cl_khr_d3d11_sharing */
44 | #define cl_khr_d3d11_sharing 1
45 |
46 | typedef cl_uint cl_d3d11_device_source_khr;
47 | typedef cl_uint cl_d3d11_device_set_khr;
48 |
49 | /******************************************************************************/
50 |
51 | /* Error Codes */
52 | #define CL_INVALID_D3D11_DEVICE_KHR -1006
53 | #define CL_INVALID_D3D11_RESOURCE_KHR -1007
54 | #define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
55 | #define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
56 |
57 | /* cl_d3d11_device_source */
58 | #define CL_D3D11_DEVICE_KHR 0x4019
59 | #define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
60 |
61 | /* cl_d3d11_device_set */
62 | #define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
63 | #define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
64 |
65 | /* cl_context_info */
66 | #define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
67 | #define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
68 |
69 | /* cl_mem_info */
70 | #define CL_MEM_D3D11_RESOURCE_KHR 0x401E
71 |
72 | /* cl_image_info */
73 | #define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
74 |
75 | /* cl_command_type */
76 | #define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
77 | #define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
78 |
79 | /******************************************************************************/
80 |
81 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
82 | cl_platform_id platform,
83 | cl_d3d11_device_source_khr d3d_device_source,
84 | void *d3d_object,
85 | cl_d3d11_device_set_khr d3d_device_set,
86 | cl_uint num_entries,
87 | cl_device_id *devices,
88 | cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2;
89 |
90 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
91 | cl_context context,
92 | cl_mem_flags flags,
93 | ID3D11Buffer *resource,
94 | cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
95 |
96 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
97 | cl_context context,
98 | cl_mem_flags flags,
99 | ID3D11Texture2D *resource,
100 | UINT subresource,
101 | cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
102 |
103 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
104 | cl_context context,
105 | cl_mem_flags flags,
106 | ID3D11Texture3D *resource,
107 | UINT subresource,
108 | cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
109 |
110 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
111 | cl_command_queue command_queue,
112 | cl_uint num_objects,
113 | const cl_mem *mem_objects,
114 | cl_uint num_events_in_wait_list,
115 | const cl_event *event_wait_list,
116 | cl_event *event) CL_API_SUFFIX__VERSION_1_2;
117 |
118 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
119 | cl_command_queue command_queue,
120 | cl_uint num_objects,
121 | const cl_mem *mem_objects,
122 | cl_uint num_events_in_wait_list,
123 | const cl_event *event_wait_list,
124 | cl_event *event) CL_API_SUFFIX__VERSION_1_2;
125 |
126 | #ifdef __cplusplus
127 | }
128 | #endif
129 |
130 | #endif /* __OPENCL_CL_D3D11_H */
131 |
132 |
--------------------------------------------------------------------------------
/libs/gles/include/CL/cl_dx9_media_sharing.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************
2 | * Copyright (c) 2008-2015 The Khronos Group Inc.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and/or associated documentation files (the
6 | * "Materials"), to deal in the Materials without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Materials, and to
9 | * permit persons to whom the Materials are furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included
13 | * in all copies or substantial portions of the Materials.
14 | *
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 | * https://www.khronos.org/registry/
19 | *
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 | **********************************************************************************/
28 |
29 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
30 |
31 | #ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
32 | #define __OPENCL_CL_DX9_MEDIA_SHARING_H
33 |
34 | #include
35 | #include
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | /******************************************************************************/
42 | /* cl_khr_dx9_media_sharing */
43 | #define cl_khr_dx9_media_sharing 1
44 |
45 | typedef cl_uint cl_dx9_media_adapter_type_khr;
46 | typedef cl_uint cl_dx9_media_adapter_set_khr;
47 |
48 | #if defined(_WIN32)
49 |
50 | #include
51 |
52 | typedef struct _cl_dx9_surface_info_khr {
53 | IDirect3DSurface9 *resource;
54 | HANDLE shared_handle;
55 | } cl_dx9_surface_info_khr;
56 | #endif
57 |
58 |
59 | /******************************************************************************/
60 |
61 | /* Error Codes */
62 | #define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
63 | #define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
64 | #define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
65 | #define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
66 |
67 | /* cl_media_adapter_type_khr */
68 | #define CL_ADAPTER_D3D9_KHR 0x2020
69 | #define CL_ADAPTER_D3D9EX_KHR 0x2021
70 | #define CL_ADAPTER_DXVA_KHR 0x2022
71 |
72 | /* cl_media_adapter_set_khr */
73 | #define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
74 | #define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
75 |
76 | /* cl_context_info */
77 | #define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
78 | #define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
79 | #define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
80 |
81 | /* cl_mem_info */
82 | #define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
83 | #define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
84 |
85 | /* cl_image_info */
86 | #define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
87 |
88 | /* cl_command_type */
89 | #define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
90 | #define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
91 |
92 | /******************************************************************************/
93 |
94 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
95 | cl_platform_id platform,
96 | cl_uint num_media_adapters,
97 | cl_dx9_media_adapter_type_khr *media_adapter_type,
98 | void *media_adapters,
99 | cl_dx9_media_adapter_set_khr media_adapter_set,
100 | cl_uint num_entries,
101 | cl_device_id *devices,
102 | cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2;
103 |
104 | typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
105 | cl_context context,
106 | cl_mem_flags flags,
107 | cl_dx9_media_adapter_type_khr adapter_type,
108 | void *surface_info,
109 | cl_uint plane,
110 | cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
111 |
112 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
113 | cl_command_queue command_queue,
114 | cl_uint num_objects,
115 | const cl_mem *mem_objects,
116 | cl_uint num_events_in_wait_list,
117 | const cl_event *event_wait_list,
118 | cl_event *event) CL_API_SUFFIX__VERSION_1_2;
119 |
120 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
121 | cl_command_queue command_queue,
122 | cl_uint num_objects,
123 | const cl_mem *mem_objects,
124 | cl_uint num_events_in_wait_list,
125 | const cl_event *event_wait_list,
126 | cl_event *event) CL_API_SUFFIX__VERSION_1_2;
127 |
128 | #ifdef __cplusplus
129 | }
130 | #endif
131 |
132 | #endif /* __OPENCL_CL_DX9_MEDIA_SHARING_H */
133 |
134 |
--------------------------------------------------------------------------------
/libs/gles/include/CL/cl_egl.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008-2015 The Khronos Group Inc.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and/or associated documentation files (the
6 | * "Materials"), to deal in the Materials without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Materials, and to
9 | * permit persons to whom the Materials are furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included
13 | * in all copies or substantial portions of the Materials.
14 | *
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 | * https://www.khronos.org/registry/
19 | *
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 | ******************************************************************************/
28 |
29 | #ifndef __OPENCL_CL_EGL_H
30 | #define __OPENCL_CL_EGL_H
31 |
32 | #ifdef __APPLE__
33 | #else
34 |
35 | #include
36 |
37 | #endif
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 |
44 | /* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
45 | #define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR 0x202F
46 | #define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR 0x202D
47 | #define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR 0x202E
48 |
49 | /* Error type for clCreateFromEGLImageKHR */
50 | #define CL_INVALID_EGL_OBJECT_KHR -1093
51 | #define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR -1092
52 |
53 | /* CLeglImageKHR is an opaque handle to an EGLImage */
54 | typedef void *CLeglImageKHR;
55 |
56 | /* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
57 | typedef void *CLeglDisplayKHR;
58 |
59 | /* CLeglSyncKHR is an opaque handle to an EGLSync object */
60 | typedef void *CLeglSyncKHR;
61 |
62 | /* properties passed to clCreateFromEGLImageKHR */
63 | typedef intptr_t cl_egl_image_properties_khr;
64 |
65 |
66 | #define cl_khr_egl_image 1
67 | #ifndef CL_NO_PROTOTYPES
68 |
69 | extern CL_API_ENTRY cl_mem CL_API_CALL
70 | clCreateFromEGLImageKHR(cl_context /* context */,
71 | CLeglDisplayKHR /* egldisplay */,
72 | CLeglImageKHR /* eglimage */,
73 | cl_mem_flags /* flags */,
74 | const cl_egl_image_properties_khr * /* properties */,
75 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
76 |
77 | #endif
78 |
79 | typedef CL_API_ENTRY cl_mem(CL_API_CALL *clCreateFromEGLImageKHR_fn)(
80 | cl_context context,
81 | CLeglDisplayKHR egldisplay,
82 | CLeglImageKHR eglimage,
83 | cl_mem_flags flags,
84 | const cl_egl_image_properties_khr *properties,
85 | cl_int *errcode_ret);
86 |
87 | #ifndef CL_NO_PROTOTYPES
88 |
89 | extern CL_API_ENTRY cl_int CL_API_CALL
90 | clEnqueueAcquireEGLObjectsKHR(cl_command_queue /* command_queue */,
91 | cl_uint /* num_objects */,
92 | const cl_mem * /* mem_objects */,
93 | cl_uint /* num_events_in_wait_list */,
94 | const cl_event * /* event_wait_list */,
95 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
96 |
97 | #endif
98 |
99 | typedef CL_API_ENTRY cl_int(CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
100 | cl_command_queue command_queue,
101 | cl_uint num_objects,
102 | const cl_mem *mem_objects,
103 | cl_uint num_events_in_wait_list,
104 | const cl_event *event_wait_list,
105 | cl_event *event);
106 |
107 | #ifndef CL_NO_PROTOTYPES
108 |
109 | extern CL_API_ENTRY cl_int CL_API_CALL
110 | clEnqueueReleaseEGLObjectsKHR(cl_command_queue /* command_queue */,
111 | cl_uint /* num_objects */,
112 | const cl_mem * /* mem_objects */,
113 | cl_uint /* num_events_in_wait_list */,
114 | const cl_event * /* event_wait_list */,
115 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
116 |
117 | #endif
118 |
119 | typedef CL_API_ENTRY cl_int(CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
120 | cl_command_queue command_queue,
121 | cl_uint num_objects,
122 | const cl_mem *mem_objects,
123 | cl_uint num_events_in_wait_list,
124 | const cl_event *event_wait_list,
125 | cl_event *event);
126 |
127 |
128 | #define cl_khr_egl_event 1
129 | #ifndef CL_NO_PROTOTYPES
130 |
131 | extern CL_API_ENTRY cl_event CL_API_CALL
132 | clCreateEventFromEGLSyncKHR(cl_context /* context */,
133 | CLeglSyncKHR /* sync */,
134 | CLeglDisplayKHR /* display */,
135 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
136 |
137 | #endif
138 |
139 | typedef CL_API_ENTRY cl_event(CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
140 | cl_context context,
141 | CLeglSyncKHR sync,
142 | CLeglDisplayKHR display,
143 | cl_int *errcode_ret);
144 |
145 | #ifdef __cplusplus
146 | }
147 | #endif
148 |
149 | #endif /* __OPENCL_CL_EGL_H */
150 |
--------------------------------------------------------------------------------
/libs/gles/include/CL/cl_gl.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************
2 | * Copyright (c) 2008-2015 The Khronos Group Inc.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and/or associated documentation files (the
6 | * "Materials"), to deal in the Materials without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Materials, and to
9 | * permit persons to whom the Materials are furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included
13 | * in all copies or substantial portions of the Materials.
14 | *
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 | * https://www.khronos.org/registry/
19 | *
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 | **********************************************************************************/
28 |
29 | #ifndef __OPENCL_CL_GL_H
30 | #define __OPENCL_CL_GL_H
31 |
32 | #ifdef __APPLE__
33 | #include
34 | #else
35 |
36 | #include
37 |
38 | #endif
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | typedef cl_uint cl_gl_object_type;
45 | typedef cl_uint cl_gl_texture_info;
46 | typedef cl_uint cl_gl_platform_info;
47 | typedef struct __GLsync *cl_GLsync;
48 |
49 | /* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
50 | #define CL_GL_OBJECT_BUFFER 0x2000
51 | #define CL_GL_OBJECT_TEXTURE2D 0x2001
52 | #define CL_GL_OBJECT_TEXTURE3D 0x2002
53 | #define CL_GL_OBJECT_RENDERBUFFER 0x2003
54 | #define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
55 | #define CL_GL_OBJECT_TEXTURE1D 0x200F
56 | #define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
57 | #define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
58 |
59 | /* cl_gl_texture_info */
60 | #define CL_GL_TEXTURE_TARGET 0x2004
61 | #define CL_GL_MIPMAP_LEVEL 0x2005
62 | #define CL_GL_NUM_SAMPLES 0x2012
63 |
64 | #ifndef CL_NO_PROTOTYPES
65 |
66 | extern CL_API_ENTRY cl_mem CL_API_CALL
67 | clCreateFromGLBuffer(cl_context /* context */,
68 | cl_mem_flags /* flags */,
69 | cl_GLuint /* bufobj */,
70 | int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
71 |
72 | extern CL_API_ENTRY cl_mem CL_API_CALL
73 | clCreateFromGLTexture(cl_context /* context */,
74 | cl_mem_flags /* flags */,
75 | cl_GLenum /* target */,
76 | cl_GLint /* miplevel */,
77 | cl_GLuint /* texture */,
78 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
79 |
80 | extern CL_API_ENTRY cl_mem CL_API_CALL
81 | clCreateFromGLRenderbuffer(cl_context /* context */,
82 | cl_mem_flags /* flags */,
83 | cl_GLuint /* renderbuffer */,
84 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
85 |
86 | extern CL_API_ENTRY cl_int CL_API_CALL
87 | clGetGLObjectInfo(cl_mem /* memobj */,
88 | cl_gl_object_type * /* gl_object_type */,
89 | cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
90 |
91 | extern CL_API_ENTRY cl_int CL_API_CALL
92 | clGetGLTextureInfo(cl_mem /* memobj */,
93 | cl_gl_texture_info /* param_name */,
94 | size_t /* param_value_size */,
95 | void * /* param_value */,
96 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
97 |
98 | extern CL_API_ENTRY cl_int CL_API_CALL
99 | clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
100 | cl_uint /* num_objects */,
101 | const cl_mem * /* mem_objects */,
102 | cl_uint /* num_events_in_wait_list */,
103 | const cl_event * /* event_wait_list */,
104 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
105 |
106 | extern CL_API_ENTRY cl_int CL_API_CALL
107 | clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
108 | cl_uint /* num_objects */,
109 | const cl_mem * /* mem_objects */,
110 | cl_uint /* num_events_in_wait_list */,
111 | const cl_event * /* event_wait_list */,
112 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
113 |
114 |
115 | /* Deprecated OpenCL 1.1 APIs */
116 | extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
117 | clCreateFromGLTexture2D(cl_context /* context */,
118 | cl_mem_flags /* flags */,
119 | cl_GLenum /* target */,
120 | cl_GLint /* miplevel */,
121 | cl_GLuint /* texture */,
122 | cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
123 |
124 | extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
125 | clCreateFromGLTexture3D(cl_context /* context */,
126 | cl_mem_flags /* flags */,
127 | cl_GLenum /* target */,
128 | cl_GLint /* miplevel */,
129 | cl_GLuint /* texture */,
130 | cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
131 |
132 | #endif
133 | /* cl_khr_gl_sharing extension */
134 |
135 | #define cl_khr_gl_sharing 1
136 |
137 | typedef cl_uint cl_gl_context_info;
138 |
139 | /* Additional Error Codes */
140 | #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
141 |
142 | /* cl_gl_context_info */
143 | #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
144 | #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
145 |
146 | /* Additional cl_context_properties */
147 | #define CL_GL_CONTEXT_KHR 0x2008
148 | #define CL_EGL_DISPLAY_KHR 0x2009
149 | #define CL_GLX_DISPLAY_KHR 0x200A
150 | #define CL_WGL_HDC_KHR 0x200B
151 | #define CL_CGL_SHAREGROUP_KHR 0x200C
152 |
153 | extern CL_API_ENTRY cl_int CL_API_CALL
154 | clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
155 | cl_gl_context_info /* param_name */,
156 | size_t /* param_value_size */,
157 | void * /* param_value */,
158 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
159 |
160 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
161 | const cl_context_properties *properties,
162 | cl_gl_context_info param_name,
163 | size_t param_value_size,
164 | void *param_value,
165 | size_t *param_value_size_ret);
166 |
167 | #ifdef __cplusplus
168 | }
169 | #endif
170 |
171 | #endif /* __OPENCL_CL_GL_H */
172 |
--------------------------------------------------------------------------------
/libs/gles/include/CL/cl_gl_ext.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************
2 | * Copyright (c) 2008-2015 The Khronos Group Inc.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and/or associated documentation files (the
6 | * "Materials"), to deal in the Materials without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Materials, and to
9 | * permit persons to whom the Materials are furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included
13 | * in all copies or substantial portions of the Materials.
14 | *
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 | * https://www.khronos.org/registry/
19 | *
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 | **********************************************************************************/
28 |
29 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
30 |
31 | /* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
32 | /* OpenGL dependencies. */
33 |
34 | #ifndef __OPENCL_CL_GL_EXT_H
35 | #define __OPENCL_CL_GL_EXT_H
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #ifdef __APPLE__
42 | #include
43 | #else
44 |
45 | #include
46 |
47 | #endif
48 |
49 | /*
50 | * For each extension, follow this template
51 | * cl_VEN_extname extension */
52 | /* #define cl_VEN_extname 1
53 | * ... define new types, if any
54 | * ... define new tokens, if any
55 | * ... define new APIs, if any
56 | *
57 | * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
58 | * This allows us to avoid having to decide whether to include GL headers or GLES here.
59 | */
60 |
61 | /*
62 | * cl_khr_gl_event extension
63 | * See section 9.9 in the OpenCL 1.1 spec for more information
64 | */
65 | #define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
66 |
67 | extern CL_API_ENTRY cl_event CL_API_CALL
68 | clCreateEventFromGLsyncKHR(cl_context /* context */,
69 | cl_GLsync /* cl_GLsync */,
70 | cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
71 |
72 | #ifdef __cplusplus
73 | }
74 | #endif
75 |
76 | #endif /* __OPENCL_CL_GL_EXT_H */
77 |
--------------------------------------------------------------------------------
/libs/gles/include/CL/opencl.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2008-2015 The Khronos Group Inc.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and/or associated documentation files (the
6 | * "Materials"), to deal in the Materials without restriction, including
7 | * without limitation the rights to use, copy, modify, merge, publish,
8 | * distribute, sublicense, and/or sell copies of the Materials, and to
9 | * permit persons to whom the Materials are furnished to do so, subject to
10 | * the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included
13 | * in all copies or substantial portions of the Materials.
14 | *
15 | * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 | * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 | * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 | * https://www.khronos.org/registry/
19 | *
20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 | * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 | ******************************************************************************/
28 |
29 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
30 |
31 | #ifndef __OPENCL_H
32 | #define __OPENCL_H
33 |
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif
37 |
38 | #ifdef __APPLE__
39 | #ifndef TARGET_OS_IPHONE
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 | #endif
46 | #else
47 |
48 | #include
49 | #include
50 | #include
51 | #include
52 |
53 | #endif
54 |
55 | #ifdef __cplusplus
56 | }
57 | #endif
58 |
59 | #endif /* __OPENCL_H */
60 |
61 |
--------------------------------------------------------------------------------
/libs/gles/include/EGL/eglplatform.h:
--------------------------------------------------------------------------------
1 | #ifndef __eglplatform_h_
2 | #define __eglplatform_h_
3 |
4 | /*
5 | ** Copyright (c) 2007-2016 The Khronos Group Inc.
6 | **
7 | ** Permission is hereby granted, free of charge, to any person obtaining a
8 | ** copy of this software and/or associated documentation files (the
9 | ** "Materials"), to deal in the Materials without restriction, including
10 | ** without limitation the rights to use, copy, modify, merge, publish,
11 | ** distribute, sublicense, and/or sell copies of the Materials, and to
12 | ** permit persons to whom the Materials are furnished to do so, subject to
13 | ** the following conditions:
14 | **
15 | ** The above copyright notice and this permission notice shall be included
16 | ** in all copies or substantial portions of the Materials.
17 | **
18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
25 | */
26 |
27 | /* Platform-specific types and definitions for egl.h
28 | * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
29 | *
30 | * Adopters may modify khrplatform.h and this file to suit their platform.
31 | * You are encouraged to submit all modifications to the Khronos group so that
32 | * they can be included in future versions of this file. Please submit changes
33 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
34 | * by filing a bug against product "EGL" component "Registry".
35 | */
36 |
37 | #include "KHR/khrplatform.h"
38 |
39 | /* Macros used in EGL function prototype declarations.
40 | *
41 | * EGL functions should be prototyped as:
42 | *
43 | * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
44 | * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
45 | *
46 | * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
47 | */
48 |
49 | #ifndef EGLAPI
50 | #define EGLAPI KHRONOS_APICALL
51 | #endif
52 |
53 | #ifndef EGLAPIENTRY
54 | #define EGLAPIENTRY KHRONOS_APIENTRY
55 | #endif
56 | #define EGLAPIENTRYP EGLAPIENTRY*
57 |
58 | /* The types NativeDisplayType, NativeWindowType, and NativePixmapType
59 | * are aliases of window-system-dependent types, such as X Display * or
60 | * Windows Device Context. They must be defined in platform-specific
61 | * code below. The EGL-prefixed versions of Native*Type are the same
62 | * types, renamed in EGL 1.3 so all types in the API start with "EGL".
63 | *
64 | * Khronos STRONGLY RECOMMENDS that you use the default definitions
65 | * provided below, since these changes affect both binary and source
66 | * portability of applications using EGL running on different EGL
67 | * implementations.
68 | */
69 |
70 | #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
71 | #ifndef WIN32_LEAN_AND_MEAN
72 | #define WIN32_LEAN_AND_MEAN 1
73 | #endif
74 |
75 | #include
76 |
77 | typedef HDC EGLNativeDisplayType;
78 | typedef HBITMAP EGLNativePixmapType;
79 | typedef HWND EGLNativeWindowType;
80 |
81 | #elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
82 |
83 | typedef int EGLNativeDisplayType;
84 | typedef void *EGLNativeWindowType;
85 | typedef void *EGLNativePixmapType;
86 |
87 | #elif defined(__ANDROID__) || defined(ANDROID)
88 |
89 | #include
90 |
91 | struct egl_native_pixmap_t;
92 |
93 | typedef struct ANativeWindow* EGLNativeWindowType;
94 | typedef struct egl_native_pixmap_t* EGLNativePixmapType;
95 | typedef void* EGLNativeDisplayType;
96 |
97 | #elif defined(SUPPORT_X11)
98 |
99 | /* X11 (tentative) */
100 | #include
101 | #include
102 |
103 | typedef Display *EGLNativeDisplayType;
104 | typedef Pixmap EGLNativePixmapType;
105 | typedef Window EGLNativeWindowType;
106 |
107 | #else
108 |
109 | #if defined(_WIN64) || __WORDSIZE == 64
110 | typedef khronos_int64_t EGLNativeDisplayType;
111 | #else
112 | typedef int EGLNativeDisplayType;
113 | #endif
114 |
115 | typedef void *EGLNativeWindowType;
116 | typedef void *EGLNativePixmapType;
117 |
118 |
119 | #endif
120 |
121 | /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
122 | typedef EGLNativeDisplayType NativeDisplayType;
123 | typedef EGLNativePixmapType NativePixmapType;
124 | typedef EGLNativeWindowType NativeWindowType;
125 |
126 |
127 | /* Define EGLint. This must be a signed integral type large enough to contain
128 | * all legal attribute names and values passed into and out of EGL, whether
129 | * their type is boolean, bitmask, enumerant (symbolic constant), integer,
130 | * handle, or other. While in general a 32-bit integer will suffice, if
131 | * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
132 | * integer type.
133 | */
134 | typedef khronos_int32_t EGLint;
135 |
136 |
137 | /* C++ / C typecast macros for special EGL handle values */
138 | #if defined(__cplusplus)
139 | #define EGL_CAST(type, value) (static_cast(value))
140 | #else
141 | #define EGL_CAST(type, value) ((type) (value))
142 | #endif
143 |
144 | #endif /* __eglplatform_h */
145 |
--------------------------------------------------------------------------------
/libs/gles/include/GLES/egl.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2008-2017 The Khronos Group Inc.
3 | **
4 | ** Licensed under the Apache License, Version 2.0 (the "License");
5 | ** you may not use this file except in compliance with the License.
6 | ** You may obtain a copy of the License at
7 | **
8 | ** http://www.apache.org/licenses/LICENSE-2.0
9 | **
10 | ** Unless required by applicable law or agreed to in writing, software
11 | ** distributed under the License is distributed on an "AS IS" BASIS,
12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | ** See the License for the specific language governing permissions and
14 | ** limitations under the License.
15 | */
16 |
17 | /*
18 | * Skeleton egl.h to provide compatibility for early GLES 1.0
19 | * applications. Several early implementations included gl.h
20 | * in egl.h leading applications to include only egl.h
21 | */
22 |
23 | #ifndef __legacy_egl_h_
24 | #define __legacy_egl_h_
25 |
26 | #include
27 | #include
28 |
29 | #endif /* __legacy_egl_h_ */
30 |
--------------------------------------------------------------------------------
/libs/gles/include/GLES/glplatform.h:
--------------------------------------------------------------------------------
1 | #ifndef __glplatform_h_
2 | #define __glplatform_h_
3 |
4 | /*
5 | ** Copyright (c) 2017 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /* Platform-specific types and definitions for OpenGL ES 1.X gl.h
21 | *
22 | * Adopters may modify khrplatform.h and this file to suit their platform.
23 | * Please contribute modifications back to Khronos as pull requests on the
24 | * public github repository:
25 | * https://github.com/KhronosGroup/OpenGL-Registry
26 | */
27 |
28 | #include
29 |
30 | #ifndef GL_API
31 | #define GL_API KHRONOS_APICALL
32 | #endif
33 |
34 | #ifndef GL_APIENTRY
35 | #define GL_APIENTRY KHRONOS_APIENTRY
36 | #endif
37 |
38 | #endif /* __glplatform_h_ */
39 |
--------------------------------------------------------------------------------
/libs/gles/include/GLES2/gl2platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl2platform_h_
2 | #define __gl2platform_h_
3 |
4 | /*
5 | ** Copyright (c) 2017 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
21 | *
22 | * Adopters may modify khrplatform.h and this file to suit their platform.
23 | * Please contribute modifications back to Khronos as pull requests on the
24 | * public github repository:
25 | * https://github.com/KhronosGroup/OpenGL-Registry
26 | */
27 |
28 | #include "KHR/khrplatform.h"
29 |
30 | #ifndef GL_APICALL
31 | #define GL_APICALL KHRONOS_APICALL
32 | #endif
33 |
34 | #ifndef GL_APIENTRY
35 | #define GL_APIENTRY KHRONOS_APIENTRY
36 | #endif
37 |
38 | #endif /* __gl2platform_h_ */
39 |
--------------------------------------------------------------------------------
/libs/gles/include/GLES3/gl3platform.h:
--------------------------------------------------------------------------------
1 | #ifndef __gl3platform_h_
2 | #define __gl3platform_h_
3 |
4 | /*
5 | ** Copyright (c) 2017 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
21 | *
22 | * Adopters may modify khrplatform.h and this file to suit their platform.
23 | * Please contribute modifications back to Khronos as pull requests on the
24 | * public github repository:
25 | * https://github.com/KhronosGroup/OpenGL-Registry
26 | */
27 |
28 | #include "KHR/khrplatform.h"
29 |
30 | #ifndef GL_APICALL
31 | #define GL_APICALL KHRONOS_APICALL
32 | #endif
33 |
34 | #ifndef GL_APIENTRY
35 | #define GL_APIENTRY KHRONOS_APIENTRY
36 | #endif
37 |
38 | #endif /* __gl3platform_h_ */
39 |
--------------------------------------------------------------------------------
/libs/gles/include/KHR/khrplatform.h:
--------------------------------------------------------------------------------
1 | #ifndef __khrplatform_h_
2 | #define __khrplatform_h_
3 |
4 | /*
5 | ** Copyright (c) 2008-2009 The Khronos Group Inc.
6 | **
7 | ** Permission is hereby granted, free of charge, to any person obtaining a
8 | ** copy of this software and/or associated documentation files (the
9 | ** "Materials"), to deal in the Materials without restriction, including
10 | ** without limitation the rights to use, copy, modify, merge, publish,
11 | ** distribute, sublicense, and/or sell copies of the Materials, and to
12 | ** permit persons to whom the Materials are furnished to do so, subject to
13 | ** the following conditions:
14 | **
15 | ** The above copyright notice and this permission notice shall be included
16 | ** in all copies or substantial portions of the Materials.
17 | **
18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
25 | */
26 |
27 | /* Khronos platform-specific types and definitions.
28 | *
29 | * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
30 | *
31 | * Adopters may modify this file to suit their platform. Adopters are
32 | * encouraged to submit platform specific modifications to the Khronos
33 | * group so that they can be included in future versions of this file.
34 | * Please submit changes by sending them to the public Khronos Bugzilla
35 | * (http://khronos.org/bugzilla) by filing a bug against product
36 | * "Khronos (general)" component "Registry".
37 | *
38 | * A predefined template which fills in some of the bug fields can be
39 | * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
40 | * must create a Bugzilla login first.
41 | *
42 | *
43 | * See the Implementer's Guidelines for information about where this file
44 | * should be located on your system and for more details of its use:
45 | * http://www.khronos.org/registry/implementers_guide.pdf
46 | *
47 | * This file should be included as
48 | * #include
49 | * by Khronos client API header files that use its types and defines.
50 | *
51 | * The types in khrplatform.h should only be used to define API-specific types.
52 | *
53 | * Types defined in khrplatform.h:
54 | * khronos_int8_t signed 8 bit
55 | * khronos_uint8_t unsigned 8 bit
56 | * khronos_int16_t signed 16 bit
57 | * khronos_uint16_t unsigned 16 bit
58 | * khronos_int32_t signed 32 bit
59 | * khronos_uint32_t unsigned 32 bit
60 | * khronos_int64_t signed 64 bit
61 | * khronos_uint64_t unsigned 64 bit
62 | * khronos_intptr_t signed same number of bits as a pointer
63 | * khronos_uintptr_t unsigned same number of bits as a pointer
64 | * khronos_ssize_t signed size
65 | * khronos_usize_t unsigned size
66 | * khronos_float_t signed 32 bit floating point
67 | * khronos_time_ns_t unsigned 64 bit time in nanoseconds
68 | * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
69 | * nanoseconds
70 | * khronos_stime_nanoseconds_t signed time interval in nanoseconds
71 | * khronos_boolean_enum_t enumerated boolean type. This should
72 | * only be used as a base type when a client API's boolean type is
73 | * an enum. Client APIs which use an integer or other type for
74 | * booleans cannot use this as the base type for their boolean.
75 | *
76 | * Tokens defined in khrplatform.h:
77 | *
78 | * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
79 | *
80 | * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
81 | * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
82 | *
83 | * Calling convention macros defined in this file:
84 | * KHRONOS_APICALL
85 | * KHRONOS_APIENTRY
86 | * KHRONOS_APIATTRIBUTES
87 | *
88 | * These may be used in function prototypes as:
89 | *
90 | * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
91 | * int arg1,
92 | * int arg2) KHRONOS_APIATTRIBUTES;
93 | */
94 |
95 | /*-------------------------------------------------------------------------
96 | * Definition of KHRONOS_APICALL
97 | *-------------------------------------------------------------------------
98 | * This precedes the return type of the function in the function prototype.
99 | */
100 | #if defined(_WIN32) && !defined(__SCITECH_SNAP__)
101 | # if defined (_DLL_EXPORTS)
102 | # define KHRONOS_APICALL __declspec(dllexport)
103 | # else
104 | # define KHRONOS_APICALL __declspec(dllimport)
105 | # endif
106 | #elif defined (__SYMBIAN32__)
107 | # define KHRONOS_APICALL IMPORT_C
108 | #elif defined(__ANDROID__)
109 | # include
110 | # define KHRONOS_APICALL __attribute__((visibility("default")))
111 | #else
112 | # define KHRONOS_APICALL
113 | #endif
114 |
115 | /*-------------------------------------------------------------------------
116 | * Definition of KHRONOS_APIENTRY
117 | *-------------------------------------------------------------------------
118 | * This follows the return type of the function and precedes the function
119 | * name in the function prototype.
120 | */
121 | #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
122 | /* Win32 but not WinCE */
123 | # define KHRONOS_APIENTRY __stdcall
124 | #else
125 | # define KHRONOS_APIENTRY
126 | #endif
127 |
128 | /*-------------------------------------------------------------------------
129 | * Definition of KHRONOS_APIATTRIBUTES
130 | *-------------------------------------------------------------------------
131 | * This follows the closing parenthesis of the function prototype arguments.
132 | */
133 | #if defined (__ARMCC_2__)
134 | #define KHRONOS_APIATTRIBUTES __softfp
135 | #else
136 | #define KHRONOS_APIATTRIBUTES
137 | #endif
138 |
139 | /*-------------------------------------------------------------------------
140 | * basic type definitions
141 | *-----------------------------------------------------------------------*/
142 | #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
143 |
144 |
145 | /*
146 | * Using
147 | */
148 | #include
149 |
150 | typedef int32_t khronos_int32_t;
151 | typedef uint32_t khronos_uint32_t;
152 | typedef int64_t khronos_int64_t;
153 | typedef uint64_t khronos_uint64_t;
154 | #define KHRONOS_SUPPORT_INT64 1
155 | #define KHRONOS_SUPPORT_FLOAT 1
156 |
157 | #elif defined(__VMS ) || defined(__sgi)
158 |
159 | /*
160 | * Using
161 | */
162 | #include
163 | typedef int32_t khronos_int32_t;
164 | typedef uint32_t khronos_uint32_t;
165 | typedef int64_t khronos_int64_t;
166 | typedef uint64_t khronos_uint64_t;
167 | #define KHRONOS_SUPPORT_INT64 1
168 | #define KHRONOS_SUPPORT_FLOAT 1
169 |
170 | #elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
171 |
172 | /*
173 | * Win32
174 | */
175 | typedef __int32 khronos_int32_t;
176 | typedef unsigned __int32 khronos_uint32_t;
177 | typedef __int64 khronos_int64_t;
178 | typedef unsigned __int64 khronos_uint64_t;
179 | #define KHRONOS_SUPPORT_INT64 1
180 | #define KHRONOS_SUPPORT_FLOAT 1
181 |
182 | #elif defined(__sun__) || defined(__digital__)
183 |
184 | /*
185 | * Sun or Digital
186 | */
187 | typedef int khronos_int32_t;
188 | typedef unsigned int khronos_uint32_t;
189 | #if defined(__arch64__) || defined(_LP64)
190 | typedef long int khronos_int64_t;
191 | typedef unsigned long int khronos_uint64_t;
192 | #else
193 | typedef long long int khronos_int64_t;
194 | typedef unsigned long long int khronos_uint64_t;
195 | #endif /* __arch64__ */
196 | #define KHRONOS_SUPPORT_INT64 1
197 | #define KHRONOS_SUPPORT_FLOAT 1
198 |
199 | #elif 0
200 |
201 | /*
202 | * Hypothetical platform with no float or int64 support
203 | */
204 | typedef int khronos_int32_t;
205 | typedef unsigned int khronos_uint32_t;
206 | #define KHRONOS_SUPPORT_INT64 0
207 | #define KHRONOS_SUPPORT_FLOAT 0
208 |
209 | #else
210 |
211 | /*
212 | * Generic fallback
213 | */
214 | #include
215 | typedef int32_t khronos_int32_t;
216 | typedef uint32_t khronos_uint32_t;
217 | typedef int64_t khronos_int64_t;
218 | typedef uint64_t khronos_uint64_t;
219 | #define KHRONOS_SUPPORT_INT64 1
220 | #define KHRONOS_SUPPORT_FLOAT 1
221 |
222 | #endif
223 |
224 |
225 | /*
226 | * Types that are (so far) the same on all platforms
227 | */
228 | typedef signed char khronos_int8_t;
229 | typedef unsigned char khronos_uint8_t;
230 | typedef signed short int khronos_int16_t;
231 | typedef unsigned short int khronos_uint16_t;
232 |
233 | /*
234 | * Types that differ between LLP64 and LP64 architectures - in LLP64,
235 | * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
236 | * to be the only LLP64 architecture in current use.
237 | */
238 | #ifdef _WIN64
239 | typedef signed long long int khronos_intptr_t;
240 | typedef unsigned long long int khronos_uintptr_t;
241 | typedef signed long long int khronos_ssize_t;
242 | typedef unsigned long long int khronos_usize_t;
243 | #else
244 | typedef signed long int khronos_intptr_t;
245 | typedef unsigned long int khronos_uintptr_t;
246 | typedef signed long int khronos_ssize_t;
247 | typedef unsigned long int khronos_usize_t;
248 | #endif
249 |
250 | #if KHRONOS_SUPPORT_FLOAT
251 | /*
252 | * Float type
253 | */
254 | typedef float khronos_float_t;
255 | #endif
256 |
257 | #if KHRONOS_SUPPORT_INT64
258 | /* Time types
259 | *
260 | * These types can be used to represent a time interval in nanoseconds or
261 | * an absolute Unadjusted System Time. Unadjusted System Time is the number
262 | * of nanoseconds since some arbitrary system event (e.g. since the last
263 | * time the system booted). The Unadjusted System Time is an unsigned
264 | * 64 bit value that wraps back to 0 every 584 years. Time intervals
265 | * may be either signed or unsigned.
266 | */
267 | typedef khronos_uint64_t khronos_utime_nanoseconds_t;
268 | typedef khronos_int64_t khronos_stime_nanoseconds_t;
269 | #endif
270 |
271 | /*
272 | * Dummy value used to pad enum types to 32 bits.
273 | */
274 | #ifndef KHRONOS_MAX_ENUM
275 | #define KHRONOS_MAX_ENUM 0x7FFFFFFF
276 | #endif
277 |
278 | /*
279 | * Enumerated boolean type
280 | *
281 | * Values other than zero should be considered to be true. Therefore
282 | * comparisons should not be made against KHRONOS_TRUE.
283 | */
284 | typedef enum {
285 | KHRONOS_FALSE = 0,
286 | KHRONOS_TRUE = 1,
287 | KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
288 | } khronos_boolean_enum_t;
289 |
290 | #endif /* __khrplatform_h_ */
291 |
--------------------------------------------------------------------------------
/libs/gles/include/PVRScopeComms.h:
--------------------------------------------------------------------------------
1 | /*!***********************************************************************
2 |
3 | @file PVRScopeComms.h
4 | @copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved.
5 | @brief PVRScopeComms header file. @copybrief ScopeComms
6 |
7 | **************************************************************************/
8 |
9 | #ifndef _PVRSCOPECOMMS_H_
10 | #define _PVRSCOPECOMMS_H_
11 |
12 | #ifdef _WIN32
13 | #define PVRSCOPE_EXPORT
14 | #else
15 | #define PVRSCOPE_EXPORT __attribute__((visibility("default")))
16 | #endif
17 |
18 | #ifdef __cplusplus
19 | extern "C" {
20 | #endif
21 |
22 | /*
23 | PVRPerfServer and PVRTune communications
24 | */
25 |
26 | /*!
27 | @addtogroup ScopeComms PVRScopeComms
28 | @brief The PVRScopeComms functionality of PVRScope allows an application to send user defined information to
29 | PVRTune via PVRPerfServer, both as counters and marks, or as editable data that can be
30 | passed back to the application.
31 | @details PVRScopeComms has the following limitations:
32 | \li PVRPerfServer must be running on the host device if a @ref ScopeComms enabled
33 | application wishes to send custom counters or marks to PVRTune. If the application in
34 | question also wishes to communicate with PVRScopeServices without experiencing any
35 | undesired behaviour PVRPerfServer should be run with the '--disable-hwperf' flag.
36 | \li The following types may be sent: Boolean, Enumerator, Float, Integer, String.
37 | @{
38 | */
39 |
40 | /****************************************************************************
41 | ** Enums
42 | ****************************************************************************/
43 |
44 | /*!**************************************************************************
45 | @enum ESPSCommsLibType
46 | @brief Each editable library item has a data type associated with it
47 | ****************************************************************************/
48 | ///
49 | enum ESPSCommsLibType {
50 | eSPSCommsLibTypeString, ///< data is string (NOT NULL-terminated, use length parameter)
51 | eSPSCommsLibTypeFloat, ///< data is SSPSCommsLibraryTypeFloat
52 | eSPSCommsLibTypeInt, ///< data is SSPSCommsLibraryTypeInt
53 | eSPSCommsLibTypeEnum, ///< data is string (NOT NULL-terminated, use length parameter). First line is selection number, subsequent lines are available options.
54 | eSPSCommsLibTypeBool ///< data is SSPSCommsLibraryTypeBool
55 | };
56 |
57 | /****************************************************************************
58 | ** Structures
59 | ****************************************************************************/
60 |
61 | // Internal implementation data
62 | struct SSPSCommsData;
63 |
64 | /*!**************************************************************************
65 | @struct SSPSCommsLibraryItem
66 | @brief Definition of one editable library item
67 | ****************************************************************************/
68 | struct SSPSCommsLibraryItem {
69 |
70 | const char *pszName; ///< Item name. If dots are used, PVRTune could show these as a foldable tree view.
71 | unsigned int nNameLength; ///< Item name length
72 |
73 | enum ESPSCommsLibType eType; ///< Item type
74 |
75 | const char *pData; ///< Item data
76 | unsigned int nDataLength; ///< Item data length
77 | };
78 |
79 | /*!**************************************************************************
80 | @struct SSPSCommsLibraryTypeFloat
81 | @brief Current, minimum and maximum values for an editable library item of type float
82 | ****************************************************************************/
83 | struct SSPSCommsLibraryTypeFloat {
84 | float fCurrent; ///< Current value
85 | float fMin; ///< Minimal value
86 | float fMax; ///< Maximum value
87 | };
88 |
89 | /*!**************************************************************************
90 | @struct SSPSCommsLibraryTypeInt
91 | @brief Current, minimum and maximum values for an editable library item of type int
92 | ****************************************************************************/
93 | struct SSPSCommsLibraryTypeInt {
94 | int nCurrent; ///< Current value
95 | int nMin; ///< Minimal value
96 | int nMax; ///< Maximum value
97 | };
98 |
99 | /*!**************************************************************************
100 | @struct SSPSCommsLibraryTypeBool
101 | @brief Current value for an editable library item of type bool
102 | ****************************************************************************/
103 | struct SSPSCommsLibraryTypeBool {
104 | int nBoolValue; ///< Boolean value (zero = false)
105 | };
106 |
107 | /*!**************************************************************************
108 | @struct SSPSCommsCounterDef
109 | @brief Definition of one custom counter
110 | ****************************************************************************/
111 | struct SSPSCommsCounterDef {
112 | const char *pszName; ///< Custom counter name
113 | unsigned int nNameLength; ///< Custom counter name length
114 | };
115 |
116 | /****************************************************************************
117 | ** Declarations
118 | ****************************************************************************/
119 |
120 |
121 | /*!**************************************************************************
122 | @brief Initialise @ref ScopeComms
123 | @return @ref ScopeComms data.
124 | ****************************************************************************/
125 | PVRSCOPE_EXPORT
126 | struct SSPSCommsData *pplInitialise(
127 | const char *const psName, ///< String to describe the application
128 | const unsigned int nNameLen ///< String length
129 | );
130 |
131 | /*!**************************************************************************
132 | @brief Shutdown or de-initialise the remote control section of PVRScope.
133 | ****************************************************************************/
134 | PVRSCOPE_EXPORT
135 | void pplShutdown(
136 | struct SSPSCommsData *psData ///< Context data
137 | );
138 |
139 | /*!**************************************************************************
140 | @brief Optional function. Sleeps until there is a connection to
141 | PVRPerfServer, or time-out. Normally, each thread will wait for
142 | its own connection, and each time-out will naturally happen in
143 | parallel. But if a thread happens to have multiple connections,
144 | N, then waiting for them all [in serial] with time-out M would
145 | take N*M ms if they were all to time-out (e.g. PVRPerfServer is
146 | not running); therefore this function, is designed to allow an
147 | entire array of connections to be waited upon simultaneously.
148 | ****************************************************************************/
149 | PVRSCOPE_EXPORT
150 | void pplWaitForConnection(
151 | struct SSPSCommsData *const psData, ///< Array of context data pointers
152 | int *const pnBoolResults, ///< Array of results - false (0) if timeout
153 | const unsigned int nCount, ///< Array length
154 | const unsigned int nTimeOutMS ///< Time-out length in milliseconds
155 | );
156 |
157 | /*!**************************************************************************
158 | @brief Query for the time. Units are microseconds, resolution is undefined.
159 | ****************************************************************************/
160 | PVRSCOPE_EXPORT
161 | unsigned int pplGetTimeUS(
162 | struct SSPSCommsData *const psData ///< Context data
163 | );
164 |
165 | /*!**************************************************************************
166 | @brief Send a time-stamped string marker to be displayed in PVRTune.
167 | @details Examples might be:
168 | \li switching to outdoor renderer
169 | \li starting benchmark test N
170 | ****************************************************************************/
171 | PVRSCOPE_EXPORT
172 | int pplSendMark(
173 | struct SSPSCommsData *const psData, ///< Context data
174 | const char *const psString, ///< String to send
175 | const unsigned int nLen ///< String length
176 | );
177 |
178 | /*!**************************************************************************
179 | @brief Send a time-stamped begin marker to PVRTune.
180 | @details Every begin must at some point be followed by an end; begin/end
181 | pairs can be nested. PVRTune will show these as an activity
182 | timeline, using a "flame graph" style when there is nesting.
183 | See also the CPPLProcessingScoped helper class.
184 | ****************************************************************************/
185 | PVRSCOPE_EXPORT
186 | int pplSendProcessingBegin(
187 | struct SSPSCommsData *const psData, ///< Context data
188 | const char *const psString, ///< Name of the processing block
189 | const unsigned int nLen, ///< String length
190 | const unsigned int nFrame ///< Iteration (or frame) number, by which processes can be grouped.
191 | );
192 |
193 | /*!**************************************************************************
194 | @brief Send a time-stamped end marker to PVRTune.
195 | @details Every begin must at some point be followed by an end; begin/end
196 | pairs can be nested. PVRTune will show these as an activity
197 | timeline, using a "flame graph" style when there is nesting.
198 | See also the CPPLProcessingScoped helper class.
199 | ****************************************************************************/
200 | PVRSCOPE_EXPORT
201 | int pplSendProcessingEnd(
202 | struct SSPSCommsData *const psData ///< Context data
203 | );
204 |
205 | /*!**************************************************************************
206 | @brief Create a library of remotely editable items
207 | ****************************************************************************/
208 | PVRSCOPE_EXPORT
209 | int pplLibraryCreate(
210 | struct SSPSCommsData *const psData, ///< Context data
211 | const struct SSPSCommsLibraryItem *const pItems, ///< Editable items
212 | const unsigned int nItemCount ///< Number of items
213 | );
214 |
215 | /*!**************************************************************************
216 | @brief Query to see whether a library item has been edited, and also
217 | retrieve the new data.
218 | ****************************************************************************/
219 | PVRSCOPE_EXPORT
220 | int pplLibraryDirtyGetFirst(
221 | struct SSPSCommsData *const psData, ///< Context data
222 | unsigned int *const pnItem, ///< Item number
223 | unsigned int *const pnNewDataLen, ///< New data length
224 | const char **ppData ///< New data
225 | );
226 |
227 | /*!**************************************************************************
228 | @brief Specify the number of custom counters and their definitions
229 | ****************************************************************************/
230 | PVRSCOPE_EXPORT
231 | int pplCountersCreate(
232 | struct SSPSCommsData *const psData, ///< Context data
233 | const struct SSPSCommsCounterDef *const psCounterDefs, ///< Counter definitions
234 | const unsigned int nCount ///< Number of counters
235 | );
236 |
237 | /*!**************************************************************************
238 | @brief Send an update for all the custom counters. The
239 | psCounterReadings array must be nCount long.
240 | ****************************************************************************/
241 | PVRSCOPE_EXPORT
242 | int pplCountersUpdate(
243 | struct SSPSCommsData *const psData, ///< Context data
244 | const unsigned int *const psCounterReadings ///< Counter readings array
245 | );
246 |
247 | /*!**************************************************************************
248 | @brief Force a cache flush.
249 | @details Some implementations store data sends in the cache. If the data
250 | rate is low, the real send of data can be significantly
251 | delayed.
252 | If it is necessary to flush the cache, the best results are
253 | likely to be achieved by calling this function with a frequency
254 | between once per second up to once per frame. If data is sent
255 | extremely infrequently, this function could be called once at
256 | the end of each bout of data send.
257 | ****************************************************************************/
258 | PVRSCOPE_EXPORT
259 | int pplSendFlush(
260 | struct SSPSCommsData *const psData ///< Context data
261 | );
262 |
263 | /*! @} */
264 |
265 | #ifdef __cplusplus
266 | }
267 |
268 | /*!**************************************************************************
269 | @class CPPLProcessingScoped
270 | @brief Helper class which will send a processing begin/end pair around
271 | its scope. You would typically instantiate these at the top of
272 | a function or after the opening curly-brace of a new scope
273 | within a function.
274 | ****************************************************************************/
275 | class CPPLProcessingScoped {
276 | protected:
277 | SSPSCommsData *const m_psData; ///< Context data
278 |
279 | public:
280 | CPPLProcessingScoped(
281 | SSPSCommsData *const psData, ///< Context data
282 | const char *const psString, ///< Name of the processing block
283 | const unsigned int nLen, ///< String length
284 | const unsigned int nFrame = 0 ///< Iteration (or frame) number, by which processes can be grouped.
285 | )
286 | : m_psData(psData) {
287 | if (m_psData)
288 | pplSendProcessingBegin(m_psData, psString, nLen, nFrame);
289 | }
290 |
291 | ~CPPLProcessingScoped() {
292 | if (m_psData)
293 | pplSendProcessingEnd(m_psData);
294 | }
295 |
296 | private:
297 | CPPLProcessingScoped(const CPPLProcessingScoped &); // Prevent copy-construction
298 | CPPLProcessingScoped &operator=(const CPPLProcessingScoped &); // Prevent assignment
299 | };
300 |
301 | #endif
302 |
303 | #undef PVRSCOPE_EXPORT
304 | #endif /* _PVRSCOPECOMMS_H_ */
305 |
306 | /*****************************************************************************
307 | End of file (PVRScopeComms.h)
308 | *****************************************************************************/
309 |
--------------------------------------------------------------------------------
/libs/gles/include/pvr_openlib.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #if defined(__linux__) || defined(__ANDROID__) || defined(__QNXNTO__) || defined(__APPLE__)
8 | #include
9 | #include
10 | #endif
11 |
12 | #if defined(_WIN32)
13 | #ifndef WIN32_LEAN_AND_MEAN
14 | #define WIN32_LEAN_AND_MEAN
15 | #endif
16 | #ifndef NOMINMAX
17 | #define NOMINMAX
18 | #endif
19 |
20 | #include
21 | #include
22 | #include
23 |
24 | #endif
25 |
26 | #if defined(_PVR_LOG_H)
27 | #define Log_Info(...) ((void)Log(LogLevel::Information, __VA_ARGS__))
28 | #define Log_Warning(...) ((void)Log(LogLevel::Warning, __VA_ARGS__))
29 | #define Log_Error(...) ((void)Log(LogLevel::Error, __VA_ARGS__))
30 | #else
31 | #if defined(__ANDROID__)
32 | #define _ANDROID 1
33 | #include
34 | #define Log_Info(...) ((void)__android_log_print(ANDROID_LOG_INFO, "com.imgtec", __VA_ARGS__))
35 | #define Log_Warning(...) ((void)__android_log_print(ANDROID_LOG_WARN, "com.imgtec", __VA_ARGS__))
36 | #define Log_Error(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "com.imgtec", __VA_ARGS__))
37 | #elif defined(_WIN32)
38 | static const char *procAddressMessageTypes[] = {
39 | "INFORMATION: ",
40 | "WARNING:",
41 | "ERROR: ",
42 | };
43 |
44 | inline void logOutput(const int logLevel, const char *const formatString, va_list argumentList) {
45 | static char buffer[4096];
46 | va_list tempList;
47 | memset(buffer, 0, sizeof(buffer));
48 |
49 | #if (defined _MSC_VER) // Pre VS2013
50 | tempList = argumentList;
51 | #else
52 | va_copy(tempList, argumentList);
53 | #endif
54 |
55 | vsnprintf(buffer, 4095, formatString, argumentList);
56 |
57 | #if defined(_WIN32) && !defined(_CONSOLE)
58 | if (IsDebuggerPresent()) {
59 | OutputDebugString(procAddressMessageTypes[logLevel]);
60 | OutputDebugString(buffer);
61 | OutputDebugString("\n");
62 | }
63 | #else
64 | printf("%s", procAddressMessageTypes[logLevel]);
65 | vprintf(formatString, tempList);
66 | printf("\n");
67 | #endif
68 | }
69 |
70 | inline void Log_Info(const char *const formatString, ...) {
71 | va_list argumentList;
72 | va_start(argumentList, formatString);
73 | logOutput(0, formatString, argumentList);
74 | va_end(argumentList);
75 | }
76 |
77 | inline void Log_Warning(const char *const formatString, ...) {
78 | va_list argumentList;
79 | va_start(argumentList, formatString);
80 | logOutput(1, formatString, argumentList);
81 | va_end(argumentList);
82 | }
83 |
84 | inline void Log_Error(const char *const formatString, ...) {
85 | va_list argumentList;
86 | va_start(argumentList, formatString);
87 | logOutput(2, formatString, argumentList);
88 | va_end(argumentList);
89 | }
90 |
91 | #else
92 | #define Log_Info(...) ((void)printf(__VA_ARGS__))
93 | #define Log_Warning(...) ((void)fprintf(stderr, __VA_ARGS__))
94 | #define Log_Error(...) ((void)fprintf(stderr, __VA_ARGS__))
95 | #endif
96 | #endif
97 |
98 | /** ABSTRACT THE PLATFORM SPEFCIFIC LIBRARY LOADING FUNCTIONS **/
99 | #if defined(_WIN32)
100 |
101 | namespace pvr{
102 | namespace lib {
103 | typedef HINSTANCE LIBTYPE;
104 | }
105 | } // namespace pvr
106 |
107 | namespace pvr{
108 | namespace internal {
109 | inline pvr::lib::LIBTYPE OpenLibrary(const char *pszPath) {
110 | #if defined(_UNICODE) // UNDER_CE
111 | if (!pszPath)
112 | {
113 | Log_Error("Path must be valid '%s'", pszPath);
114 | return nullptr;
115 | }
116 |
117 | // Get full path of executable
118 | wchar_t pszPathW[_MAX_PATH];
119 |
120 | // Convert char to wchar
121 | DWORD i = 0;
122 |
123 | for (i = 0; i <= strlen(pszPath); ++i) { pszPathW[i] = static_cast(pszPath[i]); }
124 |
125 | pszPathW[i] = ' ';
126 | pvr::lib::LIBTYPE hostLib = LoadLibraryW(pszPathW);
127 | #else
128 | pvr::lib::LIBTYPE hostLib = LoadLibraryA(pszPath);
129 | #endif
130 | if (!hostLib) { Log_Error("Could not load host library '%s'", pszPath); }
131 | Log_Info("Host library '%s' loaded", pszPath);
132 | return hostLib;
133 | }
134 |
135 | inline void CloseLibrary(pvr::lib::LIBTYPE hostLib) { FreeLibrary(hostLib); }
136 |
137 | inline void *getLibraryFunction(pvr::lib::LIBTYPE hostLib, const char *pszName) {
138 | if (hostLib) {
139 | return reinterpret_cast(GetProcAddress(hostLib, pszName));
140 | }
141 | return nullptr;
142 | }
143 | } // namespace internal
144 | } // namespace pvr
145 | #elif defined(__linux__) || defined(__QNXNTO__) || defined(__APPLE__)
146 | #if defined(__APPLE__)
147 | #if !TARGET_OS_IPHONE
148 | #include "CoreFoundation/CoreFoundation.h"
149 | static const char* g_pszEnvVar = "PVRTRACE_LIB_PATH";
150 | inline void* OpenFramework(const char* pszPath)
151 | {
152 | CFBundleRef mainBundle = CFBundleGetMainBundle();
153 | CFURLRef resourceURL = CFBundleCopyPrivateFrameworksURL(mainBundle);
154 | char path[PATH_MAX];
155 | if (!CFURLGetFileSystemRepresentation(resourceURL, TRUE, (UInt8*)path, PATH_MAX)) { return 0; }
156 | CFRelease(resourceURL);
157 |
158 | {
159 | void* lib = NULL;
160 |
161 | // --- Set a global environment variable to point to this path (for VFrame usage)
162 | const char* slash = strrchr(pszPath, '/');
163 | if (slash)
164 | {
165 | char szPath[FILENAME_MAX];
166 | memset(szPath, 0, sizeof(szPath));
167 | strncpy(szPath, pszPath, slash - pszPath);
168 | setenv(g_pszEnvVar, szPath, 1);
169 | }
170 | else
171 | {
172 | // Use the current bundle path
173 | std::string framework = std::string(path) + "/../Frameworks/";
174 | setenv(g_pszEnvVar, framework.c_str(), 1);
175 | }
176 |
177 | // --- Make a temp symlink
178 | char szTempFile[FILENAME_MAX];
179 | memset(szTempFile, 0, sizeof(szTempFile));
180 |
181 | char tmpdir[PATH_MAX];
182 | size_t n = confstr(_CS_DARWIN_USER_TEMP_DIR, tmpdir, sizeof(tmpdir));
183 | if ((n <= 0) || (n >= sizeof(tmpdir))) { strlcpy(tmpdir, getenv("TMPDIR"), sizeof(tmpdir)); }
184 |
185 | strcat(szTempFile, tmpdir);
186 | strcat(szTempFile, "tmp.XXXXXX");
187 |
188 | if (mkstemp(szTempFile))
189 | {
190 | if (symlink(pszPath, szTempFile) == 0)
191 | {
192 | lib = dlopen(szTempFile, RTLD_LAZY | RTLD_GLOBAL);
193 | remove(szTempFile);
194 | }
195 | }
196 |
197 | // --- Can't find the lib? Check the application framework folder instead.
198 | if (!lib)
199 | {
200 | std::string framework = std::string(path) + std::string("/") + pszPath;
201 | lib = dlopen(framework.c_str(), RTLD_LAZY | RTLD_GLOBAL);
202 |
203 | if (!lib)
204 | {
205 | const char* err = dlerror();
206 | if (err)
207 | {
208 | // NSLog(@"dlopen failed with error: %s => %@", err, framework);
209 | }
210 | }
211 | }
212 |
213 | return lib;
214 | }
215 | }
216 | #endif
217 | #endif
218 |
219 | namespace pvr {
220 | namespace lib {
221 | typedef void* LIBTYPE;
222 | }
223 | } // namespace pvr
224 |
225 | namespace pvr {
226 | namespace internal {
227 | #if defined(__APPLE__) && !TARGET_OS_IPHONE
228 | inline pvr::lib::LIBTYPE OpenLibrary(const char* pszPath)
229 | {
230 | // An objective-C function that uses dlopen
231 | pvr::lib::LIBTYPE hostLib = OpenFramework(pszPath);
232 | if (!hostLib) { Log_Error("Could not load host library '%s'", pszPath); }
233 | Log_Info("Host library '%s' loaded", pszPath);
234 | return hostLib;
235 | }
236 | #else
237 | namespace {
238 | inline pvr::lib::LIBTYPE OpenLibrary_Helper(const char* pszPath)
239 | {
240 | pvr::lib::LIBTYPE hostLib = dlopen(pszPath, RTLD_LAZY | RTLD_GLOBAL);
241 | if (!hostLib)
242 | {
243 | char pathMod[256];
244 | strcpy(pathMod, "./");
245 | strcat(pathMod, pszPath);
246 |
247 | hostLib = dlopen(pathMod, RTLD_LAZY | RTLD_GLOBAL);
248 | }
249 | return hostLib;
250 | }
251 | } // namespace
252 |
253 | inline pvr::lib::LIBTYPE OpenLibrary(const char* pszPath)
254 | {
255 | size_t start = 0;
256 | std::string tmp;
257 | std::string LibPath(pszPath);
258 | pvr::lib::LIBTYPE hostLib = nullptr;
259 |
260 | while (!hostLib)
261 | {
262 | size_t end = LibPath.find_first_of(';', start);
263 |
264 | if (end == std::string::npos) { tmp = LibPath.substr(start, LibPath.length() - start); }
265 | else
266 | {
267 | tmp = LibPath.substr(start, end - start);
268 | }
269 |
270 | if (!tmp.empty())
271 | {
272 | hostLib = OpenLibrary_Helper(tmp.c_str());
273 |
274 | if (!hostLib)
275 | {
276 | // Remove the last character in case a new line character snuck in
277 | tmp = tmp.substr(0, tmp.size() - 1);
278 | hostLib = OpenLibrary_Helper(tmp.c_str());
279 | }
280 | }
281 |
282 | if (end == std::string::npos) { break; }
283 |
284 | start = end + 1;
285 | }
286 | if (!hostLib)
287 | {
288 | const char* err = dlerror();
289 | if (err)
290 | {
291 | Log_Error("Could not load host library '%s'", pszPath);
292 | Log_Error("dlopen failed with error '%s'", err);
293 | }
294 | }
295 | Log_Info("Host library '%s' loaded", pszPath);
296 |
297 | return hostLib;
298 | }
299 |
300 | #endif
301 |
302 | inline void CloseLibrary(pvr::lib::LIBTYPE hostLib) { dlclose(hostLib); }
303 |
304 | inline void* getLibraryFunction(pvr::lib::LIBTYPE hostLib, const char* pszName)
305 | {
306 | if (hostLib)
307 | {
308 | void* func = dlsym(hostLib, pszName);
309 | return func;
310 | }
311 | return nullptr;
312 | }
313 | } // namespace internal
314 | } // namespace pvr
315 | #elif defined(ANDROID)
316 |
317 | namespace pvr {
318 | namespace internal {
319 | inline pvr::lib::LIBTYPE OpenLibrary(const char* pszPath)
320 | {
321 | pvr::lib::LIBTYPE hostLib = dlopen(pszPath, RTLD_LAZY | RTLD_GLOBAL);
322 | if (!hostLib)
323 | {
324 | const char* err = dlerror();
325 | if (err)
326 | {
327 | Log_Error("Could not load host library '%s'", pszPath);
328 | Log_Error("dlopen failed with error '%s'", err);
329 | }
330 | }
331 | Log_Info("Host library '%s' loaded", pszPath);
332 | return hostLib;
333 | }
334 |
335 | inline void CloseLibrary(pvr::lib::LIBTYPE hostLib) { dlclose(hostLib); }
336 |
337 | inline void* getLibraryFunction(pvr::lib::LIBTYPE hostLib, const char* pszName)
338 | {
339 | void* fnct = dlsym(hostLib, pszName);
340 | return fnct;
341 | }
342 | } // namespace internal
343 | } // namespace pvr
344 | #else
345 | #error Unsupported platform
346 | #endif
347 |
348 | namespace pvr{
349 | namespace lib {
350 | static pvr::lib::LIBTYPE hostLib = nullptr;
351 | static std::string libraryName;
352 |
353 | static inline pvr::lib::LIBTYPE openlib(const std::string
354 | &libName) {
355 | hostLib = pvr::internal::OpenLibrary(libName.c_str());
356 | libraryName = libName;
357 | return hostLib;
358 | }
359 |
360 | static inline void closelib(pvr::lib::LIBTYPE lib) { pvr::internal::CloseLibrary(lib); }
361 |
362 | template < typename
363 | PtrType_ >
364 | PtrType_
365 | inline getLibFunction(pvr::lib::LIBTYPE
366 | hostLib,
367 | const std::string
368 | &functionName) {
369 | return reinterpret_cast(pvr::internal::getLibraryFunction(hostLib, functionName.c_str()));
370 | }
371 |
372 | template < typename
373 | PtrType_ >
374 | PtrType_
375 | inline getLibFunctionChecked(pvr::lib::LIBTYPE
376 | hostLib,
377 | const std::string
378 | &functionName) {
379 | PtrType_ func = getLibFunction(hostLib, functionName);
380 | if (!func) {
381 | Log_Warning("Failed to load function [%s] from library '%s'.\n", functionName.c_str(),
382 | libraryName.c_str());
383 | }
384 | return func;
385 | }
386 | } // namespace lib
387 | } // namespace pvr
388 |
--------------------------------------------------------------------------------
/libs/gles/include/sdkver.h:
--------------------------------------------------------------------------------
1 | /*!***************************************************************************
2 | @File sdkver.h
3 |
4 | @Title Version numbers and strings.
5 |
6 | @Date 08/11/2011
7 |
8 | @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
9 |
10 | @Platform Independant
11 |
12 | @Description Version numbers and strings for SDK components.
13 |
14 | *****************************************************************************/
15 |
16 | #ifndef __SDKVER_H_
17 | #define __SDKVER_H_
18 |
19 | /*!***************************************************************************
20 | Defines
21 | *****************************************************************************/
22 |
23 | #define PVRSDK_VERSION "5.1"
24 | #define PVRSDK_BUILD "19.2@5581729"
25 | #define PVRVERSION_MAJ "19"
26 | #define PVRVERSION_MIN "2"
27 | #define PVRVERSION_BRANCH "192"
28 | #define PVRVERSION_BRANCH_DEC "19.2"
29 | #define PVRVERSION_BRANCH_NAME "REL/19.2"
30 | #define PVRVERSION_BUILD "5581729"
31 | #define PVRVERSION_BUILD_HI "558"
32 | #define PVRVERSION_BUILD_LO "1729"
33 |
34 | #define PVRSDK_COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved."
35 |
36 | #endif /* __SDKVER_H_ */
37 |
38 | /*****************************************************************************
39 | End of file (sdkver.h)
40 | *****************************************************************************/
41 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vk_icd.h:
--------------------------------------------------------------------------------
1 | //
2 | // File: vk_icd.h
3 | //
4 | /*
5 | * Copyright (c) 2015-2016 The Khronos Group Inc.
6 | * Copyright (c) 2015-2016 Valve Corporation
7 | * Copyright (c) 2015-2016 LunarG, Inc.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | *
21 | */
22 |
23 | #ifndef VKICD_H
24 | #define VKICD_H
25 |
26 | #include "vulkan.h"
27 | #include
28 |
29 | // Loader-ICD version negotiation API. Versions add the following features:
30 | // Version 0 - Initial. Doesn't support vk_icdGetInstanceProcAddr
31 | // or vk_icdNegotiateLoaderICDInterfaceVersion.
32 | // Version 1 - Add support for vk_icdGetInstanceProcAddr.
33 | // Version 2 - Add Loader/ICD Interface version negotiation
34 | // via vk_icdNegotiateLoaderICDInterfaceVersion.
35 | // Version 3 - Add ICD creation/destruction of KHR_surface objects.
36 | // Version 4 - Add unknown physical device extension qyering via
37 | // vk_icdGetPhysicalDeviceProcAddr.
38 | // Version 5 - Tells ICDs that the loader is now paying attention to the
39 | // application version of Vulkan passed into the ApplicationInfo
40 | // structure during vkCreateInstance. This will tell the ICD
41 | // that if the loader is older, it should automatically fail a
42 | // call for any API version > 1.0. Otherwise, the loader will
43 | // manually determine if it can support the expected version.
44 | #define CURRENT_LOADER_ICD_INTERFACE_VERSION 5
45 | #define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
46 | #define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4
47 |
48 | typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
49 |
50 | // This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this
51 | // file directly, it won't be found.
52 | #ifndef PFN_GetPhysicalDeviceProcAddr
53 |
54 | typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
55 |
56 | #endif
57 |
58 | /*
59 | * The ICD must reserve space for a pointer for the loader's dispatch
60 | * table, at the start of .
61 | * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
62 | */
63 |
64 | #define ICD_LOADER_MAGIC 0x01CDC0DE
65 |
66 | typedef union {
67 | uintptr_t loaderMagic;
68 | void *loaderData;
69 | } VK_LOADER_DATA;
70 |
71 | static inline void set_loader_magic_value(void *pNewObject) {
72 | VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
73 | loader_info->loaderMagic = ICD_LOADER_MAGIC;
74 | }
75 |
76 | static inline bool valid_loader_magic_value(void *pNewObject) {
77 | const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
78 | return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
79 | }
80 |
81 | /*
82 | * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
83 | * contains the platform-specific connection and surface information.
84 | */
85 | typedef enum {
86 | VK_ICD_WSI_PLATFORM_MIR,
87 | VK_ICD_WSI_PLATFORM_WAYLAND,
88 | VK_ICD_WSI_PLATFORM_WIN32,
89 | VK_ICD_WSI_PLATFORM_XCB,
90 | VK_ICD_WSI_PLATFORM_XLIB,
91 | VK_ICD_WSI_PLATFORM_ANDROID,
92 | VK_ICD_WSI_PLATFORM_MACOS,
93 | VK_ICD_WSI_PLATFORM_IOS,
94 | VK_ICD_WSI_PLATFORM_DISPLAY,
95 | VK_ICD_WSI_PLATFORM_HEADLESS
96 | } VkIcdWsiPlatform;
97 |
98 | typedef struct {
99 | VkIcdWsiPlatform platform;
100 | } VkIcdSurfaceBase;
101 |
102 | #ifdef VK_USE_PLATFORM_MIR_KHR
103 | typedef struct {
104 | VkIcdSurfaceBase base;
105 | MirConnection *connection;
106 | MirSurface *mirSurface;
107 | } VkIcdSurfaceMir;
108 | #endif // VK_USE_PLATFORM_MIR_KHR
109 |
110 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR
111 | typedef struct {
112 | VkIcdSurfaceBase base;
113 | struct wl_display *display;
114 | struct wl_surface *surface;
115 | } VkIcdSurfaceWayland;
116 | #endif // VK_USE_PLATFORM_WAYLAND_KHR
117 |
118 | #ifdef VK_USE_PLATFORM_WIN32_KHR
119 | typedef struct {
120 | VkIcdSurfaceBase base;
121 | HINSTANCE hinstance;
122 | HWND hwnd;
123 | } VkIcdSurfaceWin32;
124 | #endif // VK_USE_PLATFORM_WIN32_KHR
125 |
126 | #ifdef VK_USE_PLATFORM_XCB_KHR
127 | typedef struct {
128 | VkIcdSurfaceBase base;
129 | xcb_connection_t *connection;
130 | xcb_window_t window;
131 | } VkIcdSurfaceXcb;
132 | #endif // VK_USE_PLATFORM_XCB_KHR
133 |
134 | #ifdef VK_USE_PLATFORM_XLIB_KHR
135 | typedef struct {
136 | VkIcdSurfaceBase base;
137 | Display *dpy;
138 | Window window;
139 | } VkIcdSurfaceXlib;
140 | #endif // VK_USE_PLATFORM_XLIB_KHR
141 |
142 | #ifdef VK_USE_PLATFORM_ANDROID_KHR
143 | typedef struct {
144 | VkIcdSurfaceBase base;
145 | struct ANativeWindow *window;
146 | } VkIcdSurfaceAndroid;
147 | #endif // VK_USE_PLATFORM_ANDROID_KHR
148 |
149 | #ifdef VK_USE_PLATFORM_MACOS_MVK
150 | typedef struct {
151 | VkIcdSurfaceBase base;
152 | const void *pView;
153 | } VkIcdSurfaceMacOS;
154 | #endif // VK_USE_PLATFORM_MACOS_MVK
155 |
156 | #ifdef VK_USE_PLATFORM_IOS_MVK
157 | typedef struct {
158 | VkIcdSurfaceBase base;
159 | const void *pView;
160 | } VkIcdSurfaceIOS;
161 | #endif // VK_USE_PLATFORM_IOS_MVK
162 |
163 | typedef struct {
164 | VkIcdSurfaceBase base;
165 | VkDisplayModeKHR displayMode;
166 | uint32_t planeIndex;
167 | uint32_t planeStackIndex;
168 | VkSurfaceTransformFlagBitsKHR transform;
169 | float globalAlpha;
170 | VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
171 | VkExtent2D imageExtent;
172 | } VkIcdSurfaceDisplay;
173 |
174 | typedef struct {
175 | VkIcdSurfaceBase base;
176 | } VkIcdSurfaceHeadless;
177 |
178 | #endif // VKICD_H
179 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vk_layer.h:
--------------------------------------------------------------------------------
1 | //
2 | // File: vk_layer.h
3 | //
4 | /*
5 | * Copyright (c) 2015-2017 The Khronos Group Inc.
6 | * Copyright (c) 2015-2017 Valve Corporation
7 | * Copyright (c) 2015-2017 LunarG, Inc.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | *
21 | */
22 |
23 | /* Need to define dispatch table
24 | * Core struct can then have ptr to dispatch table at the top
25 | * Along with object ptrs for current and next OBJ
26 | */
27 | #pragma once
28 |
29 | #include "vulkan.h"
30 |
31 | #if defined(__GNUC__) && __GNUC__ >= 4
32 | #define VK_LAYER_EXPORT __attribute__((visibility("default")))
33 | #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
34 | #define VK_LAYER_EXPORT __attribute__((visibility("default")))
35 | #else
36 | #define VK_LAYER_EXPORT
37 | #endif
38 |
39 | #define MAX_NUM_UNKNOWN_EXTS 250
40 |
41 | // Loader-Layer version negotiation API. Versions add the following features:
42 | // Versions 0/1 - Initial. Doesn't support vk_layerGetPhysicalDeviceProcAddr
43 | // or vk_icdNegotiateLoaderLayerInterfaceVersion.
44 | // Version 2 - Add support for vk_layerGetPhysicalDeviceProcAddr and
45 | // vk_icdNegotiateLoaderLayerInterfaceVersion.
46 | #define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2
47 | #define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1
48 |
49 | #define VK_CURRENT_CHAIN_VERSION 1
50 |
51 | // Typedef for use in the interfaces below
52 | typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
53 |
54 | // Version negotiation values
55 | typedef enum VkNegotiateLayerStructType {
56 | LAYER_NEGOTIATE_UNINTIALIZED = 0,
57 | LAYER_NEGOTIATE_INTERFACE_STRUCT = 1,
58 | } VkNegotiateLayerStructType;
59 |
60 | // Version negotiation structures
61 | typedef struct VkNegotiateLayerInterface {
62 | VkNegotiateLayerStructType sType;
63 | void *pNext;
64 | uint32_t loaderLayerInterfaceVersion;
65 | PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr;
66 | PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr;
67 | PFN_GetPhysicalDeviceProcAddr pfnGetPhysicalDeviceProcAddr;
68 | } VkNegotiateLayerInterface;
69 |
70 | // Version negotiation functions
71 | typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegotiateLayerInterface *pVersionStruct);
72 |
73 | // Function prototype for unknown physical device extension command
74 | typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device);
75 |
76 | // ------------------------------------------------------------------------------------------------
77 | // CreateInstance and CreateDevice support structures
78 |
79 | /* Sub type of structure for instance and device loader ext of CreateInfo.
80 | * When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
81 | * or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
82 | * then VkLayerFunction indicates struct type pointed to by pNext
83 | */
84 | typedef enum VkLayerFunction_ {
85 | VK_LAYER_LINK_INFO = 0,
86 | VK_LOADER_DATA_CALLBACK = 1,
87 | VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2
88 | } VkLayerFunction;
89 |
90 | typedef struct VkLayerInstanceLink_ {
91 | struct VkLayerInstanceLink_ *pNext;
92 | PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
93 | PFN_GetPhysicalDeviceProcAddr pfnNextGetPhysicalDeviceProcAddr;
94 | } VkLayerInstanceLink;
95 |
96 | /*
97 | * When creating the device chain the loader needs to pass
98 | * down information about it's device structure needed at
99 | * the end of the chain. Passing the data via the
100 | * VkLayerDeviceInfo avoids issues with finding the
101 | * exact instance being used.
102 | */
103 | typedef struct VkLayerDeviceInfo_ {
104 | void *device_info;
105 | PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
106 | } VkLayerDeviceInfo;
107 |
108 | typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
109 | void *object);
110 |
111 | typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
112 | void *object);
113 |
114 | typedef VkResult (VKAPI_PTR *PFN_vkLayerCreateDevice)(VkInstance instance, VkPhysicalDevice physicalDevice,
115 | const VkDeviceCreateInfo *pCreateInfo,
116 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice,
117 | PFN_vkGetInstanceProcAddr layerGIPA,
118 | PFN_vkGetDeviceProcAddr *nextGDPA);
119 |
120 | typedef void (VKAPI_PTR *PFN_vkLayerDestroyDevice)(VkDevice physicalDevice, const VkAllocationCallbacks *pAllocator,
121 | PFN_vkDestroyDevice destroyFunction);
122 |
123 | typedef struct {
124 | VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
125 | const void *pNext;
126 | VkLayerFunction function;
127 | union {
128 | VkLayerInstanceLink *pLayerInfo;
129 | PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
130 | struct {
131 | PFN_vkLayerCreateDevice pfnLayerCreateDevice;
132 | PFN_vkLayerDestroyDevice pfnLayerDestroyDevice;
133 | } layerDevice;
134 | } u;
135 | } VkLayerInstanceCreateInfo;
136 |
137 | typedef struct VkLayerDeviceLink_ {
138 | struct VkLayerDeviceLink_ *pNext;
139 | PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
140 | PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
141 | } VkLayerDeviceLink;
142 |
143 | typedef struct {
144 | VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
145 | const void *pNext;
146 | VkLayerFunction function;
147 | union {
148 | VkLayerDeviceLink *pLayerInfo;
149 | PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
150 | } u;
151 | } VkLayerDeviceCreateInfo;
152 |
153 | #ifdef __cplusplus
154 | extern "C" {
155 | #endif
156 |
157 | VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct);
158 |
159 | typedef enum VkChainType {
160 | VK_CHAIN_TYPE_UNKNOWN = 0,
161 | VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES = 1,
162 | VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES = 2,
163 | VK_CHAIN_TYPE_ENUMERATE_INSTANCE_VERSION = 3,
164 | } VkChainType;
165 |
166 | typedef struct VkChainHeader {
167 | VkChainType type;
168 | uint32_t version;
169 | uint32_t size;
170 | } VkChainHeader;
171 |
172 | typedef struct VkEnumerateInstanceExtensionPropertiesChain {
173 | VkChainHeader header;
174 |
175 | VkResult
176 | (VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceExtensionPropertiesChain *, const char *, uint32_t *,
177 | VkExtensionProperties *);
178 |
179 | const struct VkEnumerateInstanceExtensionPropertiesChain *pNextLink;
180 |
181 | #if defined(__cplusplus)
182 |
183 | inline VkResult
184 | CallDown(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) const {
185 | return pfnNextLayer(pNextLink, pLayerName, pPropertyCount, pProperties);
186 | }
187 |
188 | #endif
189 | } VkEnumerateInstanceExtensionPropertiesChain;
190 |
191 | typedef struct VkEnumerateInstanceLayerPropertiesChain {
192 | VkChainHeader header;
193 |
194 | VkResult
195 | (VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceLayerPropertiesChain *, uint32_t *, VkLayerProperties *);
196 |
197 | const struct VkEnumerateInstanceLayerPropertiesChain *pNextLink;
198 |
199 | #if defined(__cplusplus)
200 |
201 | inline VkResult CallDown(uint32_t *pPropertyCount, VkLayerProperties *pProperties) const {
202 | return pfnNextLayer(pNextLink, pPropertyCount, pProperties);
203 | }
204 |
205 | #endif
206 | } VkEnumerateInstanceLayerPropertiesChain;
207 |
208 | typedef struct VkEnumerateInstanceVersionChain {
209 | VkChainHeader header;
210 |
211 | VkResult (VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceVersionChain *, uint32_t *);
212 |
213 | const struct VkEnumerateInstanceVersionChain *pNextLink;
214 |
215 | #if defined(__cplusplus)
216 |
217 | inline VkResult CallDown(uint32_t *pApiVersion) const {
218 | return pfnNextLayer(pNextLink, pApiVersion);
219 | }
220 |
221 | #endif
222 | } VkEnumerateInstanceVersionChain;
223 |
224 | #ifdef __cplusplus
225 | }
226 | #endif
227 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vk_platform.h:
--------------------------------------------------------------------------------
1 | //
2 | // File: vk_platform.h
3 | //
4 | /*
5 | ** Copyright (c) 2014-2017 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 |
21 | #ifndef VK_PLATFORM_H_
22 | #define VK_PLATFORM_H_
23 |
24 | #ifdef __cplusplus
25 | extern "C"
26 | {
27 | #endif // __cplusplus
28 |
29 | /*
30 | ***************************************************************************************************
31 | * Platform-specific directives and type declarations
32 | ***************************************************************************************************
33 | */
34 |
35 | /* Platform-specific calling convention macros.
36 | *
37 | * Platforms should define these so that Vulkan clients call Vulkan commands
38 | * with the same calling conventions that the Vulkan implementation expects.
39 | *
40 | * VKAPI_ATTR - Placed before the return type in function declarations.
41 | * Useful for C++11 and GCC/Clang-style function attribute syntax.
42 | * VKAPI_CALL - Placed after the return type in function declarations.
43 | * Useful for MSVC-style calling convention syntax.
44 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
45 | *
46 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
47 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
48 | */
49 | #if defined(_WIN32)
50 | // On Windows, Vulkan commands use the stdcall convention
51 | #define VKAPI_ATTR
52 | #define VKAPI_CALL __stdcall
53 | #define VKAPI_PTR VKAPI_CALL
54 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
55 | #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
56 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
57 | // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
58 | // calling convention, i.e. float parameters are passed in registers. This
59 | // is true even if the rest of the application passes floats on the stack,
60 | // as it does by default when compiling for the armeabi-v7a NDK ABI.
61 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
62 | #define VKAPI_CALL
63 | #define VKAPI_PTR VKAPI_ATTR
64 | #else
65 | // On other platforms, use the default calling convention
66 | #define VKAPI_ATTR
67 | #define VKAPI_CALL
68 | #define VKAPI_PTR
69 | #endif
70 |
71 | #include
72 |
73 | #if !defined(VK_NO_STDINT_H)
74 | #if defined(_MSC_VER) && (_MSC_VER < 1600)
75 | typedef signed __int8 int8_t;
76 | typedef unsigned __int8 uint8_t;
77 | typedef signed __int16 int16_t;
78 | typedef unsigned __int16 uint16_t;
79 | typedef signed __int32 int32_t;
80 | typedef unsigned __int32 uint32_t;
81 | typedef signed __int64 int64_t;
82 | typedef unsigned __int64 uint64_t;
83 | #else
84 |
85 | #include
86 |
87 | #endif
88 | #endif // !defined(VK_NO_STDINT_H)
89 |
90 | #ifdef __cplusplus
91 | } // extern "C"
92 | #endif // __cplusplus
93 |
94 | #endif
95 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vk_sdk_platform.h:
--------------------------------------------------------------------------------
1 | //
2 | // File: vk_sdk_platform.h
3 | //
4 | /*
5 | * Copyright (c) 2015-2016 The Khronos Group Inc.
6 | * Copyright (c) 2015-2016 Valve Corporation
7 | * Copyright (c) 2015-2016 LunarG, Inc.
8 | *
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | */
21 |
22 | #ifndef VK_SDK_PLATFORM_H
23 | #define VK_SDK_PLATFORM_H
24 |
25 | #if defined(_WIN32)
26 | #define NOMINMAX
27 | #ifndef __cplusplus
28 | #undef inline
29 | #define inline __inline
30 | #endif // __cplusplus
31 |
32 | #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
33 | // C99:
34 | // Microsoft didn't implement C99 in Visual Studio; but started adding it with
35 | // VS2013. However, VS2013 still didn't have snprintf(). The following is a
36 | // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the
37 | // "CMakeLists.txt" file).
38 | // NOTE: This is fixed in Visual Studio 2015.
39 | #define snprintf _snprintf
40 | #endif
41 |
42 | #define strdup _strdup
43 |
44 | #endif // _WIN32
45 |
46 | // Check for noexcept support using clang, with fallback to Windows or GCC version numbers
47 | #ifndef NOEXCEPT
48 | #if defined(__clang__)
49 | #if __has_feature(cxx_noexcept)
50 | #define HAS_NOEXCEPT
51 | #endif
52 | #else
53 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46
54 | #define HAS_NOEXCEPT
55 | #else
56 | #if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS
57 | #define HAS_NOEXCEPT
58 | #endif
59 | #endif
60 | #endif
61 |
62 | #ifdef HAS_NOEXCEPT
63 | #define NOEXCEPT noexcept
64 | #else
65 | #define NOEXCEPT
66 | #endif
67 | #endif
68 |
69 | #endif // VK_SDK_PLATFORM_H
70 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_H_
2 | #define VULKAN_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | #include "vk_platform.h"
21 | #include "vulkan_core.h"
22 |
23 | #ifdef VK_USE_PLATFORM_ANDROID_KHR
24 | #include "vulkan_android.h"
25 | #endif
26 |
27 | #ifdef VK_USE_PLATFORM_FUCHSIA
28 | #include
29 | #include "vulkan_fuchsia.h"
30 | #endif
31 |
32 | #ifdef VK_USE_PLATFORM_IOS_MVK
33 | #include "vulkan_ios.h"
34 | #endif
35 |
36 |
37 | #ifdef VK_USE_PLATFORM_MACOS_MVK
38 | #include "vulkan_macos.h"
39 | #endif
40 |
41 | #ifdef VK_USE_PLATFORM_METAL_EXT
42 | #include "vulkan_metal.h"
43 | #endif
44 |
45 | #ifdef VK_USE_PLATFORM_VI_NN
46 | #include "vulkan_vi.h"
47 | #endif
48 |
49 |
50 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR
51 | #include
52 | #include "vulkan_wayland.h"
53 | #endif
54 |
55 |
56 | #ifdef VK_USE_PLATFORM_WIN32_KHR
57 | #include
58 | #include "vulkan_win32.h"
59 | #endif
60 |
61 |
62 | #ifdef VK_USE_PLATFORM_XCB_KHR
63 | #include
64 | #include "vulkan_xcb.h"
65 | #endif
66 |
67 |
68 | #ifdef VK_USE_PLATFORM_XLIB_KHR
69 | #include
70 | #include "vulkan_xlib.h"
71 | #endif
72 |
73 |
74 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
75 | #include
76 | #include
77 | #include "vulkan_xlib_xrandr.h"
78 | #endif
79 |
80 |
81 | #ifdef VK_USE_PLATFORM_GGP
82 | #include
83 | #include "vulkan_ggp.h"
84 | #endif
85 |
86 | #endif // VULKAN_H_
87 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_android.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_ANDROID_H_
2 | #define VULKAN_ANDROID_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_KHR_android_surface 1
32 | struct ANativeWindow;
33 | #define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
34 | #define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
35 | typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
36 | typedef struct VkAndroidSurfaceCreateInfoKHR {
37 | VkStructureType sType;
38 | const void *pNext;
39 | VkAndroidSurfaceCreateFlagsKHR flags;
40 | struct ANativeWindow *window;
41 | } VkAndroidSurfaceCreateInfoKHR;
42 |
43 | typedef VkResult (VKAPI_PTR
44 | * PFN_vkCreateAndroidSurfaceKHR ) (
45 | VkInstance instance,
46 | const VkAndroidSurfaceCreateInfoKHR *pCreateInfo,
47 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
48 | * pSurface );
49 |
50 | #ifndef VK_NO_PROTOTYPES
51 | VKAPI_ATTR VkResult
52 |
53 | VKAPI_CALL vkCreateAndroidSurfaceKHR(
54 | VkInstance instance,
55 | const VkAndroidSurfaceCreateInfoKHR *pCreateInfo,
56 | const VkAllocationCallbacks *pAllocator,
57 | VkSurfaceKHR *pSurface);
58 |
59 | #endif
60 |
61 |
62 | #define VK_ANDROID_external_memory_android_hardware_buffer 1
63 | struct AHardwareBuffer;
64 | #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 3
65 | #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer"
66 | typedef struct VkAndroidHardwareBufferUsageANDROID {
67 | VkStructureType sType;
68 | void *pNext;
69 | uint64_t androidHardwareBufferUsage;
70 | } VkAndroidHardwareBufferUsageANDROID;
71 |
72 | typedef struct VkAndroidHardwareBufferPropertiesANDROID {
73 | VkStructureType sType;
74 | void *pNext;
75 | VkDeviceSize allocationSize;
76 | uint32_t memoryTypeBits;
77 | } VkAndroidHardwareBufferPropertiesANDROID;
78 |
79 | typedef struct VkAndroidHardwareBufferFormatPropertiesANDROID {
80 | VkStructureType sType;
81 | void *pNext;
82 | VkFormat format;
83 | uint64_t externalFormat;
84 | VkFormatFeatureFlags formatFeatures;
85 | VkComponentMapping samplerYcbcrConversionComponents;
86 | VkSamplerYcbcrModelConversion suggestedYcbcrModel;
87 | VkSamplerYcbcrRange suggestedYcbcrRange;
88 | VkChromaLocation suggestedXChromaOffset;
89 | VkChromaLocation suggestedYChromaOffset;
90 | } VkAndroidHardwareBufferFormatPropertiesANDROID;
91 |
92 | typedef struct VkImportAndroidHardwareBufferInfoANDROID {
93 | VkStructureType sType;
94 | const void *pNext;
95 | struct AHardwareBuffer *buffer;
96 | } VkImportAndroidHardwareBufferInfoANDROID;
97 |
98 | typedef struct VkMemoryGetAndroidHardwareBufferInfoANDROID {
99 | VkStructureType sType;
100 | const void *pNext;
101 | VkDeviceMemory memory;
102 | } VkMemoryGetAndroidHardwareBufferInfoANDROID;
103 |
104 | typedef struct VkExternalFormatANDROID {
105 | VkStructureType sType;
106 | void *pNext;
107 | uint64_t externalFormat;
108 | } VkExternalFormatANDROID;
109 |
110 | typedef VkResult (VKAPI_PTR
111 | * PFN_vkGetAndroidHardwareBufferPropertiesANDROID ) (
112 | VkDevice device,
113 | const struct AHardwareBuffer *buffer, VkAndroidHardwareBufferPropertiesANDROID
114 | * pProperties );
115 | typedef VkResult (VKAPI_PTR
116 | * PFN_vkGetMemoryAndroidHardwareBufferANDROID ) (
117 | VkDevice device,
118 | const VkMemoryGetAndroidHardwareBufferInfoANDROID *pInfo,
119 | struct AHardwareBuffer **pBuffer
120 | );
121 |
122 | #ifndef VK_NO_PROTOTYPES
123 | VKAPI_ATTR VkResult
124 |
125 | VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID(
126 | VkDevice device,
127 | const struct AHardwareBuffer *buffer,
128 | VkAndroidHardwareBufferPropertiesANDROID *pProperties);
129 |
130 | VKAPI_ATTR VkResult
131 |
132 | VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID(
133 | VkDevice device,
134 | const VkMemoryGetAndroidHardwareBufferInfoANDROID *pInfo,
135 | struct AHardwareBuffer **pBuffer);
136 |
137 | #endif
138 |
139 | #ifdef __cplusplus
140 | }
141 | #endif
142 |
143 | #endif
144 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_fuchsia.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_FUCHSIA_H_
2 | #define VULKAN_FUCHSIA_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_FUCHSIA_imagepipe_surface 1
32 | #define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1
33 | #define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface"
34 | typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA;
35 | typedef struct VkImagePipeSurfaceCreateInfoFUCHSIA {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkImagePipeSurfaceCreateFlagsFUCHSIA flags;
39 | zx_handle_t imagePipeHandle;
40 | } VkImagePipeSurfaceCreateInfoFUCHSIA;
41 |
42 | typedef VkResult (VKAPI_PTR
43 | * PFN_vkCreateImagePipeSurfaceFUCHSIA ) (
44 | VkInstance instance,
45 | const VkImagePipeSurfaceCreateInfoFUCHSIA *pCreateInfo,
46 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
47 | * pSurface );
48 |
49 | #ifndef VK_NO_PROTOTYPES
50 | VKAPI_ATTR VkResult
51 |
52 | VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(
53 | VkInstance instance,
54 | const VkImagePipeSurfaceCreateInfoFUCHSIA *pCreateInfo,
55 | const VkAllocationCallbacks *pAllocator,
56 | VkSurfaceKHR *pSurface);
57 |
58 | #endif
59 |
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_ggp.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_GGP_H_
2 | #define VULKAN_GGP_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_GGP_stream_descriptor_surface 1
32 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1
33 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface"
34 | typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP;
35 | typedef struct VkStreamDescriptorSurfaceCreateInfoGGP {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkStreamDescriptorSurfaceCreateFlagsGGP flags;
39 | GgpStreamDescriptor streamDescriptor;
40 | } VkStreamDescriptorSurfaceCreateInfoGGP;
41 |
42 | typedef VkResult (VKAPI_PTR
43 | * PFN_vkCreateStreamDescriptorSurfaceGGP ) (
44 | VkInstance instance,
45 | const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo,
46 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
47 | * pSurface );
48 |
49 | #ifndef VK_NO_PROTOTYPES
50 | VKAPI_ATTR VkResult
51 |
52 | VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP(
53 | VkInstance instance,
54 | const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo,
55 | const VkAllocationCallbacks *pAllocator,
56 | VkSurfaceKHR *pSurface);
57 |
58 | #endif
59 |
60 |
61 | #define VK_GGP_frame_token 1
62 | #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1
63 | #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token"
64 | typedef struct VkPresentFrameTokenGGP {
65 | VkStructureType sType;
66 | const void *pNext;
67 | GgpFrameToken frameToken;
68 | } VkPresentFrameTokenGGP;
69 |
70 |
71 | #ifdef __cplusplus
72 | }
73 | #endif
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_ios.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_IOS_H_
2 | #define VULKAN_IOS_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_MVK_ios_surface 1
32 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 2
33 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
34 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK;
35 | typedef struct VkIOSSurfaceCreateInfoMVK {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkIOSSurfaceCreateFlagsMVK flags;
39 | const void *pView;
40 | } VkIOSSurfaceCreateInfoMVK;
41 |
42 | typedef VkResult (VKAPI_PTR
43 | * PFN_vkCreateIOSSurfaceMVK ) (
44 | VkInstance instance,
45 | const VkIOSSurfaceCreateInfoMVK *pCreateInfo,
46 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
47 | * pSurface );
48 |
49 | #ifndef VK_NO_PROTOTYPES
50 | VKAPI_ATTR VkResult
51 |
52 | VKAPI_CALL vkCreateIOSSurfaceMVK(
53 | VkInstance instance,
54 | const VkIOSSurfaceCreateInfoMVK *pCreateInfo,
55 | const VkAllocationCallbacks *pAllocator,
56 | VkSurfaceKHR *pSurface);
57 |
58 | #endif
59 |
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_macos.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_MACOS_H_
2 | #define VULKAN_MACOS_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_MVK_macos_surface 1
32 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2
33 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
34 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
35 | typedef struct VkMacOSSurfaceCreateInfoMVK {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkMacOSSurfaceCreateFlagsMVK flags;
39 | const void *pView;
40 | } VkMacOSSurfaceCreateInfoMVK;
41 |
42 | typedef VkResult (VKAPI_PTR
43 | * PFN_vkCreateMacOSSurfaceMVK ) (
44 | VkInstance instance,
45 | const VkMacOSSurfaceCreateInfoMVK *pCreateInfo,
46 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
47 | * pSurface );
48 |
49 | #ifndef VK_NO_PROTOTYPES
50 | VKAPI_ATTR VkResult
51 |
52 | VKAPI_CALL vkCreateMacOSSurfaceMVK(
53 | VkInstance instance,
54 | const VkMacOSSurfaceCreateInfoMVK *pCreateInfo,
55 | const VkAllocationCallbacks *pAllocator,
56 | VkSurfaceKHR *pSurface);
57 |
58 | #endif
59 |
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_metal.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_METAL_H_
2 | #define VULKAN_METAL_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_EXT_metal_surface 1
32 |
33 | #ifdef __OBJC__
34 | @class CAMetalLayer;
35 | #else
36 | typedef void CAMetalLayer;
37 | #endif
38 |
39 | #define VK_EXT_METAL_SURFACE_SPEC_VERSION 1
40 | #define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface"
41 | typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
42 | typedef struct VkMetalSurfaceCreateInfoEXT {
43 | VkStructureType sType;
44 | const void *pNext;
45 | VkMetalSurfaceCreateFlagsEXT flags;
46 | const CAMetalLayer *pLayer;
47 | } VkMetalSurfaceCreateInfoEXT;
48 |
49 | typedef VkResult (VKAPI_PTR
50 | *PFN_vkCreateMetalSurfaceEXT)(
51 | VkInstance instance,
52 | const VkMetalSurfaceCreateInfoEXT *pCreateInfo,
53 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
54 | * pSurface);
55 |
56 | #ifndef VK_NO_PROTOTYPES
57 | VKAPI_ATTR VkResult
58 |
59 | VKAPI_CALL vkCreateMetalSurfaceEXT(
60 | VkInstance instance,
61 | const VkMetalSurfaceCreateInfoEXT *pCreateInfo,
62 | const VkAllocationCallbacks *pAllocator,
63 | VkSurfaceKHR *pSurface);
64 |
65 | #endif
66 |
67 | #ifdef __cplusplus
68 | }
69 | #endif
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_vi.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_VI_H_
2 | #define VULKAN_VI_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_NN_vi_surface 1
32 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1
33 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface"
34 | typedef VkFlags VkViSurfaceCreateFlagsNN;
35 | typedef struct VkViSurfaceCreateInfoNN {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkViSurfaceCreateFlagsNN flags;
39 | void *window;
40 | } VkViSurfaceCreateInfoNN;
41 |
42 | typedef VkResult (VKAPI_PTR
43 | * PFN_vkCreateViSurfaceNN ) (
44 | VkInstance instance,
45 | const VkViSurfaceCreateInfoNN *pCreateInfo,
46 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
47 | * pSurface );
48 |
49 | #ifndef VK_NO_PROTOTYPES
50 | VKAPI_ATTR VkResult
51 |
52 | VKAPI_CALL vkCreateViSurfaceNN(
53 | VkInstance instance,
54 | const VkViSurfaceCreateInfoNN *pCreateInfo,
55 | const VkAllocationCallbacks *pAllocator,
56 | VkSurfaceKHR *pSurface);
57 |
58 | #endif
59 |
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_wayland.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_WAYLAND_H_
2 | #define VULKAN_WAYLAND_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_KHR_wayland_surface 1
32 | #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6
33 | #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
34 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
35 | typedef struct VkWaylandSurfaceCreateInfoKHR {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkWaylandSurfaceCreateFlagsKHR flags;
39 | struct wl_display *display;
40 | struct wl_surface *surface;
41 | } VkWaylandSurfaceCreateInfoKHR;
42 |
43 | typedef VkResult (VKAPI_PTR
44 | * PFN_vkCreateWaylandSurfaceKHR ) (
45 | VkInstance instance,
46 | const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
47 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
48 | * pSurface );
49 | typedef VkBool32 (VKAPI_PTR
50 | * PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR ) (
51 | VkPhysicalDevice physicalDevice, uint32_t
52 | queueFamilyIndex ,
53 | struct wl_display *display
54 | );
55 |
56 | #ifndef VK_NO_PROTOTYPES
57 | VKAPI_ATTR VkResult
58 |
59 | VKAPI_CALL vkCreateWaylandSurfaceKHR(
60 | VkInstance instance,
61 | const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
62 | const VkAllocationCallbacks *pAllocator,
63 | VkSurfaceKHR *pSurface);
64 |
65 | VKAPI_ATTR VkBool32
66 |
67 | VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(
68 | VkPhysicalDevice physicalDevice,
69 | uint32_t queueFamilyIndex,
70 | struct wl_display *display);
71 |
72 | #endif
73 |
74 | #ifdef __cplusplus
75 | }
76 | #endif
77 |
78 | #endif
79 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_win32.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_WIN32_H_
2 | #define VULKAN_WIN32_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_KHR_win32_surface 1
32 | #define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6
33 | #define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
34 | typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
35 | typedef struct VkWin32SurfaceCreateInfoKHR {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkWin32SurfaceCreateFlagsKHR flags;
39 | HINSTANCE hinstance;
40 | HWND hwnd;
41 | } VkWin32SurfaceCreateInfoKHR;
42 |
43 | typedef VkResult (VKAPI_PTR
44 | * PFN_vkCreateWin32SurfaceKHR ) (
45 | VkInstance instance,
46 | const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
47 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
48 | * pSurface );
49 | typedef VkBool32 (VKAPI_PTR
50 | * PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR ) (
51 | VkPhysicalDevice physicalDevice, uint32_t
52 | queueFamilyIndex );
53 |
54 | #ifndef VK_NO_PROTOTYPES
55 | VKAPI_ATTR VkResult
56 |
57 | VKAPI_CALL vkCreateWin32SurfaceKHR(
58 | VkInstance instance,
59 | const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
60 | const VkAllocationCallbacks *pAllocator,
61 | VkSurfaceKHR *pSurface);
62 |
63 | VKAPI_ATTR VkBool32
64 |
65 | VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
66 | VkPhysicalDevice physicalDevice,
67 | uint32_t queueFamilyIndex);
68 |
69 | #endif
70 |
71 |
72 | #define VK_KHR_external_memory_win32 1
73 | #define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
74 | #define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32"
75 | typedef struct VkImportMemoryWin32HandleInfoKHR {
76 | VkStructureType sType;
77 | const void *pNext;
78 | VkExternalMemoryHandleTypeFlagBits handleType;
79 | HANDLE handle;
80 | LPCWSTR name;
81 | } VkImportMemoryWin32HandleInfoKHR;
82 |
83 | typedef struct VkExportMemoryWin32HandleInfoKHR {
84 | VkStructureType sType;
85 | const void *pNext;
86 | const SECURITY_ATTRIBUTES *pAttributes;
87 | DWORD dwAccess;
88 | LPCWSTR name;
89 | } VkExportMemoryWin32HandleInfoKHR;
90 |
91 | typedef struct VkMemoryWin32HandlePropertiesKHR {
92 | VkStructureType sType;
93 | void *pNext;
94 | uint32_t memoryTypeBits;
95 | } VkMemoryWin32HandlePropertiesKHR;
96 |
97 | typedef struct VkMemoryGetWin32HandleInfoKHR {
98 | VkStructureType sType;
99 | const void *pNext;
100 | VkDeviceMemory memory;
101 | VkExternalMemoryHandleTypeFlagBits handleType;
102 | } VkMemoryGetWin32HandleInfoKHR;
103 |
104 | typedef VkResult (VKAPI_PTR
105 | * PFN_vkGetMemoryWin32HandleKHR ) (
106 | VkDevice device,
107 | const VkMemoryGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE
108 | * pHandle );
109 | typedef VkResult (VKAPI_PTR
110 | * PFN_vkGetMemoryWin32HandlePropertiesKHR ) (
111 | VkDevice device, VkExternalMemoryHandleTypeFlagBits
112 | handleType ,
113 | HANDLE handle, VkMemoryWin32HandlePropertiesKHR
114 | * pMemoryWin32HandleProperties );
115 |
116 | #ifndef VK_NO_PROTOTYPES
117 | VKAPI_ATTR VkResult
118 |
119 | VKAPI_CALL vkGetMemoryWin32HandleKHR(
120 | VkDevice device,
121 | const VkMemoryGetWin32HandleInfoKHR *pGetWin32HandleInfo,
122 | HANDLE *pHandle);
123 |
124 | VKAPI_ATTR VkResult
125 |
126 | VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(
127 | VkDevice device,
128 | VkExternalMemoryHandleTypeFlagBits handleType,
129 | HANDLE handle,
130 | VkMemoryWin32HandlePropertiesKHR *pMemoryWin32HandleProperties);
131 |
132 | #endif
133 |
134 |
135 | #define VK_KHR_win32_keyed_mutex 1
136 | #define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1
137 | #define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex"
138 | typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR {
139 | VkStructureType sType;
140 | const void *pNext;
141 | uint32_t acquireCount;
142 | const VkDeviceMemory *pAcquireSyncs;
143 | const uint64_t *pAcquireKeys;
144 | const uint32_t *pAcquireTimeouts;
145 | uint32_t releaseCount;
146 | const VkDeviceMemory *pReleaseSyncs;
147 | const uint64_t *pReleaseKeys;
148 | } VkWin32KeyedMutexAcquireReleaseInfoKHR;
149 |
150 |
151 | #define VK_KHR_external_semaphore_win32 1
152 | #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1
153 | #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32"
154 | typedef struct VkImportSemaphoreWin32HandleInfoKHR {
155 | VkStructureType sType;
156 | const void *pNext;
157 | VkSemaphore semaphore;
158 | VkSemaphoreImportFlags flags;
159 | VkExternalSemaphoreHandleTypeFlagBits handleType;
160 | HANDLE handle;
161 | LPCWSTR name;
162 | } VkImportSemaphoreWin32HandleInfoKHR;
163 |
164 | typedef struct VkExportSemaphoreWin32HandleInfoKHR {
165 | VkStructureType sType;
166 | const void *pNext;
167 | const SECURITY_ATTRIBUTES *pAttributes;
168 | DWORD dwAccess;
169 | LPCWSTR name;
170 | } VkExportSemaphoreWin32HandleInfoKHR;
171 |
172 | typedef struct VkD3D12FenceSubmitInfoKHR {
173 | VkStructureType sType;
174 | const void *pNext;
175 | uint32_t waitSemaphoreValuesCount;
176 | const uint64_t *pWaitSemaphoreValues;
177 | uint32_t signalSemaphoreValuesCount;
178 | const uint64_t *pSignalSemaphoreValues;
179 | } VkD3D12FenceSubmitInfoKHR;
180 |
181 | typedef struct VkSemaphoreGetWin32HandleInfoKHR {
182 | VkStructureType sType;
183 | const void *pNext;
184 | VkSemaphore semaphore;
185 | VkExternalSemaphoreHandleTypeFlagBits handleType;
186 | } VkSemaphoreGetWin32HandleInfoKHR;
187 |
188 | typedef VkResult (VKAPI_PTR
189 | * PFN_vkImportSemaphoreWin32HandleKHR ) (
190 | VkDevice device,
191 | const VkImportSemaphoreWin32HandleInfoKHR *pImportSemaphoreWin32HandleInfo
192 | );
193 | typedef VkResult (VKAPI_PTR
194 | * PFN_vkGetSemaphoreWin32HandleKHR ) (
195 | VkDevice device,
196 | const VkSemaphoreGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE
197 | * pHandle );
198 |
199 | #ifndef VK_NO_PROTOTYPES
200 | VKAPI_ATTR VkResult
201 |
202 | VKAPI_CALL vkImportSemaphoreWin32HandleKHR(
203 | VkDevice device,
204 | const VkImportSemaphoreWin32HandleInfoKHR *pImportSemaphoreWin32HandleInfo);
205 |
206 | VKAPI_ATTR VkResult
207 |
208 | VKAPI_CALL vkGetSemaphoreWin32HandleKHR(
209 | VkDevice device,
210 | const VkSemaphoreGetWin32HandleInfoKHR *pGetWin32HandleInfo,
211 | HANDLE *pHandle);
212 |
213 | #endif
214 |
215 |
216 | #define VK_KHR_external_fence_win32 1
217 | #define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1
218 | #define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32"
219 | typedef struct VkImportFenceWin32HandleInfoKHR {
220 | VkStructureType sType;
221 | const void *pNext;
222 | VkFence fence;
223 | VkFenceImportFlags flags;
224 | VkExternalFenceHandleTypeFlagBits handleType;
225 | HANDLE handle;
226 | LPCWSTR name;
227 | } VkImportFenceWin32HandleInfoKHR;
228 |
229 | typedef struct VkExportFenceWin32HandleInfoKHR {
230 | VkStructureType sType;
231 | const void *pNext;
232 | const SECURITY_ATTRIBUTES *pAttributes;
233 | DWORD dwAccess;
234 | LPCWSTR name;
235 | } VkExportFenceWin32HandleInfoKHR;
236 |
237 | typedef struct VkFenceGetWin32HandleInfoKHR {
238 | VkStructureType sType;
239 | const void *pNext;
240 | VkFence fence;
241 | VkExternalFenceHandleTypeFlagBits handleType;
242 | } VkFenceGetWin32HandleInfoKHR;
243 |
244 | typedef VkResult (VKAPI_PTR
245 | * PFN_vkImportFenceWin32HandleKHR ) (
246 | VkDevice device,
247 | const VkImportFenceWin32HandleInfoKHR *pImportFenceWin32HandleInfo
248 | );
249 | typedef VkResult (VKAPI_PTR
250 | * PFN_vkGetFenceWin32HandleKHR ) (
251 | VkDevice device,
252 | const VkFenceGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE
253 | * pHandle );
254 |
255 | #ifndef VK_NO_PROTOTYPES
256 | VKAPI_ATTR VkResult
257 |
258 | VKAPI_CALL vkImportFenceWin32HandleKHR(
259 | VkDevice device,
260 | const VkImportFenceWin32HandleInfoKHR *pImportFenceWin32HandleInfo);
261 |
262 | VKAPI_ATTR VkResult
263 |
264 | VKAPI_CALL vkGetFenceWin32HandleKHR(
265 | VkDevice device,
266 | const VkFenceGetWin32HandleInfoKHR *pGetWin32HandleInfo,
267 | HANDLE *pHandle);
268 |
269 | #endif
270 |
271 |
272 | #define VK_NV_external_memory_win32 1
273 | #define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
274 | #define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
275 | typedef struct VkImportMemoryWin32HandleInfoNV {
276 | VkStructureType sType;
277 | const void *pNext;
278 | VkExternalMemoryHandleTypeFlagsNV handleType;
279 | HANDLE handle;
280 | } VkImportMemoryWin32HandleInfoNV;
281 |
282 | typedef struct VkExportMemoryWin32HandleInfoNV {
283 | VkStructureType sType;
284 | const void *pNext;
285 | const SECURITY_ATTRIBUTES *pAttributes;
286 | DWORD dwAccess;
287 | } VkExportMemoryWin32HandleInfoNV;
288 |
289 | typedef VkResult (VKAPI_PTR
290 | * PFN_vkGetMemoryWin32HandleNV ) (
291 | VkDevice device, VkDeviceMemory
292 | memory ,
293 | VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE
294 | * pHandle );
295 |
296 | #ifndef VK_NO_PROTOTYPES
297 | VKAPI_ATTR VkResult
298 |
299 | VKAPI_CALL vkGetMemoryWin32HandleNV(
300 | VkDevice device,
301 | VkDeviceMemory memory,
302 | VkExternalMemoryHandleTypeFlagsNV handleType,
303 | HANDLE *pHandle);
304 |
305 | #endif
306 |
307 |
308 | #define VK_NV_win32_keyed_mutex 1
309 | #define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2
310 | #define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
311 | typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
312 | VkStructureType sType;
313 | const void *pNext;
314 | uint32_t acquireCount;
315 | const VkDeviceMemory *pAcquireSyncs;
316 | const uint64_t *pAcquireKeys;
317 | const uint32_t *pAcquireTimeoutMilliseconds;
318 | uint32_t releaseCount;
319 | const VkDeviceMemory *pReleaseSyncs;
320 | const uint64_t *pReleaseKeys;
321 | } VkWin32KeyedMutexAcquireReleaseInfoNV;
322 |
323 |
324 | #define VK_EXT_full_screen_exclusive 1
325 | #define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4
326 | #define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive"
327 |
328 | typedef enum VkFullScreenExclusiveEXT {
329 | VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT = 0,
330 | VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT = 1,
331 | VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT = 2,
332 | VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT = 3,
333 | VK_FULL_SCREEN_EXCLUSIVE_BEGIN_RANGE_EXT = VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT,
334 | VK_FULL_SCREEN_EXCLUSIVE_END_RANGE_EXT = VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT,
335 | VK_FULL_SCREEN_EXCLUSIVE_RANGE_SIZE_EXT = (VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT -
336 | VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT + 1),
337 | VK_FULL_SCREEN_EXCLUSIVE_MAX_ENUM_EXT = 0x7FFFFFFF
338 | } VkFullScreenExclusiveEXT;
339 | typedef struct VkSurfaceFullScreenExclusiveInfoEXT {
340 | VkStructureType sType;
341 | void *pNext;
342 | VkFullScreenExclusiveEXT fullScreenExclusive;
343 | } VkSurfaceFullScreenExclusiveInfoEXT;
344 |
345 | typedef struct VkSurfaceCapabilitiesFullScreenExclusiveEXT {
346 | VkStructureType sType;
347 | void *pNext;
348 | VkBool32 fullScreenExclusiveSupported;
349 | } VkSurfaceCapabilitiesFullScreenExclusiveEXT;
350 |
351 | typedef struct VkSurfaceFullScreenExclusiveWin32InfoEXT {
352 | VkStructureType sType;
353 | const void *pNext;
354 | HMONITOR hmonitor;
355 | } VkSurfaceFullScreenExclusiveWin32InfoEXT;
356 |
357 | typedef VkResult (VKAPI_PTR
358 | * PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT ) (
359 | VkPhysicalDevice physicalDevice,
360 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t
361 | * pPresentModeCount ,
362 | VkPresentModeKHR *pPresentModes
363 | );
364 | typedef VkResult (VKAPI_PTR
365 | * PFN_vkAcquireFullScreenExclusiveModeEXT ) (
366 | VkDevice device, VkSwapchainKHR
367 | swapchain );
368 | typedef VkResult (VKAPI_PTR
369 | * PFN_vkReleaseFullScreenExclusiveModeEXT ) (
370 | VkDevice device, VkSwapchainKHR
371 | swapchain );
372 | typedef VkResult (VKAPI_PTR
373 | * PFN_vkGetDeviceGroupSurfacePresentModes2EXT ) (
374 | VkDevice device,
375 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkDeviceGroupPresentModeFlagsKHR
376 | * pModes );
377 |
378 | #ifndef VK_NO_PROTOTYPES
379 | VKAPI_ATTR VkResult
380 |
381 | VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModes2EXT(
382 | VkPhysicalDevice physicalDevice,
383 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
384 | uint32_t *pPresentModeCount,
385 | VkPresentModeKHR *pPresentModes);
386 |
387 | VKAPI_ATTR VkResult
388 |
389 | VKAPI_CALL vkAcquireFullScreenExclusiveModeEXT(
390 | VkDevice device,
391 | VkSwapchainKHR swapchain);
392 |
393 | VKAPI_ATTR VkResult
394 |
395 | VKAPI_CALL vkReleaseFullScreenExclusiveModeEXT(
396 | VkDevice device,
397 | VkSwapchainKHR swapchain);
398 |
399 | VKAPI_ATTR VkResult
400 |
401 | VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT(
402 | VkDevice device,
403 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
404 | VkDeviceGroupPresentModeFlagsKHR *pModes);
405 |
406 | #endif
407 |
408 | #ifdef __cplusplus
409 | }
410 | #endif
411 |
412 | #endif
413 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_xcb.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_XCB_H_
2 | #define VULKAN_XCB_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_KHR_xcb_surface 1
32 | #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6
33 | #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
34 | typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
35 | typedef struct VkXcbSurfaceCreateInfoKHR {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkXcbSurfaceCreateFlagsKHR flags;
39 | xcb_connection_t *connection;
40 | xcb_window_t window;
41 | } VkXcbSurfaceCreateInfoKHR;
42 |
43 | typedef VkResult (VKAPI_PTR
44 | * PFN_vkCreateXcbSurfaceKHR ) (
45 | VkInstance instance,
46 | const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
47 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
48 | * pSurface );
49 | typedef VkBool32 (VKAPI_PTR
50 | * PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR ) (
51 | VkPhysicalDevice physicalDevice, uint32_t
52 | queueFamilyIndex ,
53 | xcb_connection_t *connection, xcb_visualid_t
54 | visual_id );
55 |
56 | #ifndef VK_NO_PROTOTYPES
57 | VKAPI_ATTR VkResult
58 |
59 | VKAPI_CALL vkCreateXcbSurfaceKHR(
60 | VkInstance instance,
61 | const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
62 | const VkAllocationCallbacks *pAllocator,
63 | VkSurfaceKHR *pSurface);
64 |
65 | VKAPI_ATTR VkBool32
66 |
67 | VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(
68 | VkPhysicalDevice physicalDevice,
69 | uint32_t queueFamilyIndex,
70 | xcb_connection_t *connection,
71 | xcb_visualid_t visual_id);
72 |
73 | #endif
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_xlib.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_XLIB_H_
2 | #define VULKAN_XLIB_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_KHR_xlib_surface 1
32 | #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
33 | #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
34 | typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
35 | typedef struct VkXlibSurfaceCreateInfoKHR {
36 | VkStructureType sType;
37 | const void *pNext;
38 | VkXlibSurfaceCreateFlagsKHR flags;
39 | Display *dpy;
40 | Window window;
41 | } VkXlibSurfaceCreateInfoKHR;
42 |
43 | typedef VkResult (VKAPI_PTR
44 | * PFN_vkCreateXlibSurfaceKHR ) (
45 | VkInstance instance,
46 | const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
47 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR
48 | * pSurface );
49 | typedef VkBool32 (VKAPI_PTR
50 | * PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR ) (
51 | VkPhysicalDevice physicalDevice, uint32_t
52 | queueFamilyIndex ,
53 | Display *dpy, VisualID
54 | visualID );
55 |
56 | #ifndef VK_NO_PROTOTYPES
57 | VKAPI_ATTR VkResult
58 |
59 | VKAPI_CALL vkCreateXlibSurfaceKHR(
60 | VkInstance instance,
61 | const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
62 | const VkAllocationCallbacks *pAllocator,
63 | VkSurfaceKHR *pSurface);
64 |
65 | VKAPI_ATTR VkBool32
66 |
67 | VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
68 | VkPhysicalDevice physicalDevice,
69 | uint32_t queueFamilyIndex,
70 | Display *dpy,
71 | VisualID visualID);
72 |
73 | #endif
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/libs/gles/include/vulkan/vulkan_xlib_xrandr.h:
--------------------------------------------------------------------------------
1 | #ifndef VULKAN_XLIB_XRANDR_H_
2 | #define VULKAN_XLIB_XRANDR_H_ 1
3 |
4 | /*
5 | ** Copyright (c) 2015-2019 The Khronos Group Inc.
6 | **
7 | ** Licensed under the Apache License, Version 2.0 (the "License");
8 | ** you may not use this file except in compliance with the License.
9 | ** You may obtain a copy of the License at
10 | **
11 | ** http://www.apache.org/licenses/LICENSE-2.0
12 | **
13 | ** Unless required by applicable law or agreed to in writing, software
14 | ** distributed under the License is distributed on an "AS IS" BASIS,
15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ** See the License for the specific language governing permissions and
17 | ** limitations under the License.
18 | */
19 |
20 | /*
21 | ** This header is generated from the Khronos Vulkan XML API Registry.
22 | **
23 | */
24 |
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 |
31 | #define VK_EXT_acquire_xlib_display 1
32 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1
33 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display"
34 | typedef VkResult (VKAPI_PTR
35 | * PFN_vkAcquireXlibDisplayEXT ) (
36 | VkPhysicalDevice physicalDevice, Display
37 | * dpy ,
38 | VkDisplayKHR display
39 | );
40 | typedef VkResult (VKAPI_PTR
41 | * PFN_vkGetRandROutputDisplayEXT ) (
42 | VkPhysicalDevice physicalDevice, Display
43 | * dpy ,
44 | RROutput rrOutput, VkDisplayKHR
45 | * pDisplay );
46 |
47 | #ifndef VK_NO_PROTOTYPES
48 | VKAPI_ATTR VkResult
49 |
50 | VKAPI_CALL vkAcquireXlibDisplayEXT(
51 | VkPhysicalDevice physicalDevice,
52 | Display *dpy,
53 | VkDisplayKHR display);
54 |
55 | VKAPI_ATTR VkResult
56 |
57 | VKAPI_CALL vkGetRandROutputDisplayEXT(
58 | VkPhysicalDevice physicalDevice,
59 | Display *dpy,
60 | RROutput rrOutput,
61 | VkDisplayKHR *pDisplay);
62 |
63 | #endif
64 |
65 | #ifdef __cplusplus
66 | }
67 | #endif
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/libs/gles/lib/libEGL.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/libs/gles/lib/libEGL.lib
--------------------------------------------------------------------------------
/libs/gles/lib/libGLES_CM.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/libs/gles/lib/libGLES_CM.lib
--------------------------------------------------------------------------------
/libs/gles/lib/libGLESv2.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/libs/gles/lib/libGLESv2.lib
--------------------------------------------------------------------------------
/samples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 | project(samples)
3 | if (MSVC)
4 | if (CMAKE_BUILD_TYPE STREQUAL "Debug")
5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
6 | else ()
7 | set(CMAKE_BUILD_TYPE "Release")
8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /Gy /Oi /Oy /O2 /Ot /Zi /EHsc ")
9 | endif ()
10 | ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
11 | else ()
12 | if (CMAKE_BUILD_TYPE STREQUAL "Debug")
13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -Wno-unused-variable")
14 | else (CMAKE_BUILD_TYPE STREQUAL "Debug")
15 | set(CMAKE_BUILD_TYPE "Release")
16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")
17 | endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
18 | endif ()
19 | include_directories(common/include)
20 | include_directories(.)
21 |
22 | SUBDIRS(common Hello_Font)
23 |
--------------------------------------------------------------------------------
/samples/Common/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(common_src source/es_util.cpp)
2 | set(common_platform_src source/es_util_win32.cpp)
3 | add_library(Common STATIC ${common_src} ${common_platform_src})
4 | target_link_libraries(Common ${GLES_LIBRARIES})
--------------------------------------------------------------------------------
/samples/Common/Include/es_util_win.h:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2013 Dan Ginsburg, Budirijanto Purnomo
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | //
24 | // Book: OpenGL(R) ES 3.0 Programming Guide, 2nd Edition
25 | // Authors: Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi
26 | // ISBN-10: 0-321-93388-5
27 | // ISBN-13: 978-0-321-93388-1
28 | // Publisher: Addison-Wesley Professional
29 | // URLs: http://www.opengles-book.com
30 | // http://my.safaribooksonline.com/book/animation-and-3d/9780133440133
31 | //
32 | // esUtil_win.h
33 | //
34 | // API-neutral interface for creating windows. Implementation needs to be provided per-platform.
35 |
36 | #ifndef ESUTIL_WIN_H
37 | #define ESUTIL_WIN_H
38 |
39 | ///
40 | // Includes
41 | //
42 |
43 | #ifdef __cplusplus
44 |
45 |
46 | ///
47 | // Macros
48 | //
49 |
50 | ///
51 | // Types
52 | //
53 |
54 | ///
55 | // Public Functions
56 | //
57 |
58 | ///
59 | // WinCreate()
60 | //
61 | // Create Win32 instance and window
62 | //
63 | GLboolean WinCreate(ESContext *esContext, const char *title);
64 |
65 | #endif
66 |
67 | #endif // ESUTIL_WIN_H
--------------------------------------------------------------------------------
/samples/Common/Source/es_util_win32.cpp:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2013 Dan Ginsburg, Budirijanto Purnomo
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | //
24 | // Book: OpenGL(R) ES 3.0 Programming Guide, 2nd Edition
25 | // Authors: Dan Ginsburg, Budirijanto Purnomo, Dave Shreiner, Aaftab Munshi
26 | // ISBN-10: 0-321-93388-5
27 | // ISBN-13: 978-0-321-93388-1
28 | // Publisher: Addison-Wesley Professional
29 | // URLs: http://www.opengles-book.com
30 | // http://my.safaribooksonline.com/book/animation-and-3d/9780133440133
31 | //
32 | // esUtil_win32.c
33 | //
34 | // This file contains the Win32 implementation of the windowing functions.
35 |
36 |
37 | ///
38 | // Includes
39 | //
40 | #define WIN32_LEAN_AND_MEAN
41 |
42 | #include
43 | #include
44 | #include "es_util.h"
45 |
46 | #ifdef _WIN64
47 | #define GWL_USERDATA GWLP_USERDATA
48 | #endif
49 |
50 | //////////////////////////////////////////////////////////////////
51 | //
52 | // Private Functions
53 | //
54 | //
55 |
56 | ///
57 | // ESWindowProc()
58 | //
59 | // Main window procedure
60 | //
61 | LRESULT WINAPI ESWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
62 | LRESULT lRet = 1;
63 | static POINT resolution = {0};
64 | ESContext *esContext = (ESContext *) (LONG_PTR) GetWindowLongPtr(hWnd, GWL_USERDATA);
65 | switch (uMsg) {
66 | case WM_CREATE:
67 | break;
68 |
69 | case WM_PAINT: {
70 | if (esContext && esContext->drawFunc) {
71 | esContext->drawFunc(esContext);
72 | eglSwapBuffers(esContext->eglDisplay, esContext->eglSurface);
73 | }
74 |
75 | if (esContext) {
76 | ValidateRect(esContext->eglNativeWindow, NULL);
77 | }
78 | }
79 | break;
80 |
81 | case WM_DESTROY:
82 | PostQuitMessage(0);
83 | break;
84 |
85 | case WM_CHAR: {
86 | POINT point;
87 |
88 | GetCursorPos(&point);
89 |
90 | if (esContext && esContext->keyFunc)
91 | esContext->keyFunc(esContext, (unsigned char) wParam,
92 | (int) point.x, (int) point.y);
93 | }
94 | break;
95 | case WM_KEYDOWN: {
96 | if (esContext) {
97 | if (wParam < 256) {
98 | esContext->keyboard.toggle[wParam] = ~esContext->keyboard.toggle[wParam];
99 | esContext->keyboard.state[wParam] = 0xff;
100 | }
101 | }
102 | return 0;
103 | }
104 | case WM_KEYUP: {
105 | if (esContext) {
106 | if (wParam < 256) {
107 | esContext->keyboard.state[wParam] = 0;
108 | }
109 | }
110 | return 0;
111 | }
112 | case WM_SIZING: {
113 | if (esContext) {
114 | LPRECT lpRect = (LPRECT) lParam;
115 | esContext->resolution.x = lpRect->right - lpRect->left;
116 | esContext->resolution.y = lpRect->bottom - lpRect->top;
117 | }
118 | return 0;
119 | }
120 | case WM_LBUTTONDOWN: {
121 | if (esContext) {
122 | POINTS points = MAKEPOINTS(lParam);
123 | esContext->mouse.z = (float) points.x;
124 | esContext->mouse.w = resolution.y - points.y;
125 | }
126 | return true;
127 | }
128 | case WM_LBUTTONUP: {
129 | if (esContext) {
130 | esContext->mouse.z = -fabs(esContext->mouse.z);
131 | esContext->mouse.w = -fabs(esContext->mouse.w);
132 | }
133 | return true;
134 | }
135 | case WM_MOUSEMOVE: {
136 | if (esContext) {
137 | if (wParam & MK_LBUTTON) {
138 | POINTS points = MAKEPOINTS(lParam);
139 | esContext->mouse.x = (float) points.x;
140 | esContext->mouse.y = resolution.y - points.y;
141 | }
142 | }
143 | return true;
144 | }
145 | case WM_SIZE: {
146 | resolution.x = LOWORD(lParam);
147 | resolution.y = HIWORD(lParam);
148 | return 0;
149 | }
150 | default:
151 | lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
152 | break;
153 | }
154 |
155 | return lRet;
156 | }
157 |
158 | //////////////////////////////////////////////////////////////////
159 | //
160 | // Public Functions
161 | //
162 | //
163 |
164 | ///
165 | // WinCreate()
166 | //
167 | // Create Win32 instance and window
168 | //
169 | GLboolean WinCreate(ESContext *esContext, const char *title) {
170 | WNDCLASS wndclass = {0};
171 | DWORD wStyle = 0;
172 | RECT windowRect;
173 | HINSTANCE hInstance = GetModuleHandle(NULL);
174 |
175 |
176 | wndclass.style = CS_OWNDC;
177 | wndclass.lpfnWndProc = (WNDPROC) ESWindowProc;
178 | wndclass.hInstance = hInstance;
179 | wndclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
180 | wndclass.lpszClassName = "opengles3.0";
181 |
182 | if (!RegisterClass(&wndclass)) {
183 | return FALSE;
184 | }
185 |
186 | wStyle = WS_VISIBLE | WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME;
187 |
188 | // Adjust the window rectangle so that the client area has
189 | // the correct number of pixels
190 | windowRect.left = 0;
191 | windowRect.top = 0;
192 | windowRect.right = esContext->width;
193 | windowRect.bottom = esContext->height;
194 |
195 | AdjustWindowRect(&windowRect, wStyle, FALSE);
196 |
197 |
198 | esContext->eglNativeWindow = CreateWindow (
199 | "opengles3.0",
200 | title,
201 | wStyle,
202 | 0,
203 | 0,
204 | windowRect.right - windowRect.left,
205 | windowRect.bottom - windowRect.top,
206 | NULL,
207 | NULL,
208 | hInstance,
209 | NULL);
210 |
211 | // Set the ESContext* to the GWL_USERDATA so that it is available to the
212 | // ESWindowProc
213 | #ifdef _WIN64
214 | //In LLP64 LONG is stll 32bit.
215 | SetWindowLongPtr(esContext->eglNativeWindow, GWL_USERDATA, (LONGLONG) (LONG_PTR) esContext);
216 | #else
217 | SetWindowLongPtr ( esContext->eglNativeWindow, GWL_USERDATA, ( LONG ) ( LONG_PTR ) esContext );
218 | #endif
219 |
220 |
221 | if (esContext->eglNativeWindow == NULL) {
222 | return GL_FALSE;
223 | }
224 |
225 | ShowWindow(esContext->eglNativeWindow, TRUE);
226 |
227 | return GL_TRUE;
228 | }
229 |
230 | ///
231 | // WinLoop()
232 | //
233 | // Start main windows loop
234 | //
235 | void WinLoop(ESContext *esContext) {
236 | MSG msg = {0};
237 | int done = 0;
238 | DWORD lastTime = GetTickCount();
239 |
240 | while (!done) {
241 | int gotMsg = (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) != 0);
242 | DWORD curTime = GetTickCount();
243 | float deltaTime = (float) (curTime - lastTime) / 1000.0f;
244 | lastTime = curTime;
245 |
246 | if (gotMsg) {
247 | if (msg.message == WM_QUIT) {
248 | done = 1;
249 | } else {
250 | TranslateMessage(&msg);
251 | DispatchMessage(&msg);
252 | }
253 | } else {
254 | SendMessage(esContext->eglNativeWindow, WM_PAINT, 0, 0);
255 | }
256 |
257 | // Call update function if registered
258 | if (esContext->updateFunc != NULL) {
259 | esContext->updateFunc(esContext, deltaTime);
260 | }
261 | }
262 | }
263 |
264 | ///
265 | // Global extern. The application must declare this function
266 | // that runs the application.
267 | //
268 | extern int esMain(ESContext *esContext, int argc, char *argv[]);
269 |
270 | ///
271 | // main()
272 | //
273 | // Main entrypoint for application
274 | //
275 | int main(int argc, char *argv[]) {
276 | ESContext esContext;
277 |
278 | memset(&esContext, 0, sizeof(ESContext));
279 |
280 | if (esMain(&esContext, argc, argv) != GL_TRUE) {
281 | return 1;
282 | }
283 |
284 | WinLoop(&esContext);
285 |
286 | if (esContext.shutdownFunc != NULL) {
287 | esContext.shutdownFunc(&esContext);
288 | }
289 |
290 | if (esContext.userData != NULL) {
291 | free(esContext.userData);
292 | }
293 |
294 | return 0;
295 | }
296 |
--------------------------------------------------------------------------------
/samples/Hello_Font/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if (MSVC)
2 | if (CMAKE_BUILD_TYPE STREQUAL "Debug")
3 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
4 | else ()
5 | set(CMAKE_BUILD_TYPE "Release")
6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /Gy /Oi /Oy /O2 /Ot /Zi /EHsc ")
7 | endif ()
8 | ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
9 | else ()
10 | if (CMAKE_BUILD_TYPE STREQUAL "Debug")
11 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall -Wno-unused-variable")
12 | else (CMAKE_BUILD_TYPE STREQUAL "Debug")
13 | set(CMAKE_BUILD_TYPE "Release")
14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")
15 | endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
16 | endif ()
17 |
18 | file(GLOB TINYFONT_SRC
19 | ${CMAKE_CURRENT_LIST_DIR}/tiny_font/*.c
20 | ${CMAKE_CURRENT_LIST_DIR}/tiny_font/*.cc
21 | ${CMAKE_CURRENT_LIST_DIR}/tiny_font/*.cpp)
22 | include_directories(tiny_font)
23 | add_executable(Hello_Font Hello_Font.cpp ${TINYFONT_SRC})
24 | target_link_libraries(Hello_Font Common)
25 | configure_file(DroidSerif-Bold.ttf ${CMAKE_CURRENT_BINARY_DIR}/DroidSerif-Bold.ttf COPYONLY)
26 | configure_file(DroidSerif-Italic.ttf ${CMAKE_CURRENT_BINARY_DIR}/DroidSerif-Italic.ttf COPYONLY)
27 | configure_file(DroidSerif-Regular.ttf ${CMAKE_CURRENT_BINARY_DIR}/DroidSerif-Regular.ttf COPYONLY)
28 | configure_file(SourceHanSansCN-Normal.otf ${CMAKE_CURRENT_BINARY_DIR}/SourceHanSansCN-Normal.otf COPYONLY)
29 | configure_file(${GLES_ROOT_DIR}/bin/libGLES_CM.dll ${CMAKE_CURRENT_BINARY_DIR}/libGLES_CM.dll COPYONLY)
30 | configure_file(${GLES_ROOT_DIR}/bin/libGLESv2.dll ${CMAKE_CURRENT_BINARY_DIR}/libGLESv2.dll COPYONLY)
31 | configure_file(${GLES_ROOT_DIR}/bin/libEGL.dll ${CMAKE_CURRENT_BINARY_DIR}/libEGL.dll COPYONLY)
--------------------------------------------------------------------------------
/samples/Hello_Font/DroidSerif-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/samples/Hello_Font/DroidSerif-Bold.ttf
--------------------------------------------------------------------------------
/samples/Hello_Font/DroidSerif-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/samples/Hello_Font/DroidSerif-Italic.ttf
--------------------------------------------------------------------------------
/samples/Hello_Font/DroidSerif-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/samples/Hello_Font/DroidSerif-Regular.ttf
--------------------------------------------------------------------------------
/samples/Hello_Font/Hello_Font.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include "es_util.h"
4 | #include "tiny_font_stash.h"
5 | #include "tiny_primitive_renderer.h"
6 | #include "tiny_fontstashcallbacks.h"
7 |
8 | typedef struct {
9 | // Handle to a program object
10 | sth_stash *stash;
11 | RenderCallbacks *m_renderCallbacks;
12 | TinyGLPrimitiveRenderer *m_primRenderer;
13 | int droidRegular, droidItalic, droidBold, droidChinese;
14 | } UserData;
15 |
16 | int loadFonts(struct sth_stash *stash, int *droidRegular, int *droidItalic, int *droidBold, int *droidChinese) {
17 | // Load the first truetype font from memory (just because we can).
18 | FILE *fp = fopen("DroidSerif-Regular.ttf", "rb");
19 | if (!fp) return 0;
20 | fseek(fp, 0, SEEK_END);
21 | int datasize = (int) ftell(fp);
22 | fseek(fp, 0, SEEK_SET);
23 | unsigned char *data = (unsigned char *) malloc(datasize);
24 | if (!data) return 0;
25 | fread(data, 1, datasize, fp);
26 | fclose(fp);
27 | fp = 0;
28 | if (!(*droidRegular = sth_add_font_from_memory(stash, data))) return 0;
29 | // Load the remaining truetype fonts directly.
30 | if (!(*droidItalic = sth_add_font(stash, "DroidSerif-Italic.ttf"))) return 0;
31 | if (!(*droidBold = sth_add_font(stash, "DroidSerif-Bold.ttf"))) return 0;
32 | if (!(*droidChinese = sth_add_font(stash, "SourceHanSansCN-Normal.otf"))) return 0;
33 | return 1;
34 | }
35 |
36 | ///
37 | // Initialize the shader and program object
38 | //
39 | //
40 | int Init(ESContext *esContext, int argc, char *argv[]) {
41 | UserData *userData = (UserData *) (esContext->userData);
42 | // Store the program object
43 | userData->m_primRenderer = new TinyGLPrimitiveRenderer(esContext->width, esContext->height);
44 | userData->m_primRenderer->set_screen_size(esContext->width, esContext->height);
45 | userData->m_renderCallbacks = new OpenGLRenderCallbacks(userData->m_primRenderer);
46 | userData->stash = sth_create(
47 | 512, 512, userData->m_renderCallbacks);
48 | if (!userData->stash) fprintf(stderr, "Could not create stash.\n");
49 | loadFonts(userData->stash, &userData->droidRegular, &userData->droidItalic, &userData->droidBold,
50 | &userData->droidChinese);
51 | glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
52 | return TRUE;
53 | }
54 |
55 | ///
56 | // Draw a triangle using the shader pair created in Init()
57 | //
58 | void Draw(ESContext *esContext) {
59 | UserData *userData = (UserData *) (esContext->userData);
60 | sth_stash *stash = userData->stash;
61 | // Set the viewport
62 | glViewport(0, 0, esContext->width, esContext->height);
63 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
64 | glEnable(GL_BLEND);
65 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
66 |
67 | float sx = 50, sy = 150, lh;
68 | float dx = sx, dy = sy, scale = 3.0f;
69 | int screenWidth = userData->m_primRenderer->get_screen_width();
70 | int screenHeight = userData->m_primRenderer->get_screen_height();
71 | sth_begin_draw(stash);
72 | float color_white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
73 | sth_draw_text(stash, userData->droidRegular, 24.0f * scale, dx, dy, "The quick ", &dx, screenWidth, screenHeight,
74 | false, 1., color_white);
75 | sth_draw_text(stash, userData->droidItalic, 48.0f * scale, dx, dy, "brown ", &dx, screenWidth, screenHeight,
76 | false, 1., color_white);
77 | sth_draw_text(stash, userData->droidRegular, 24.0f * scale, dx, dy, "fox ", &dx, screenWidth, screenHeight,
78 | false, 1., color_white);
79 | sth_vmetrics(stash, userData->droidItalic, 24 * scale, NULL, NULL, &lh);
80 | sth_end_draw(stash);
81 | dx = sx;
82 | dy += lh * 1.2f;
83 | sth_begin_draw(stash);
84 | float color_red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
85 | sth_draw_text(stash, userData->droidItalic, 24.0f * scale, dx, dy, "jumps over ", &dx, screenWidth, screenHeight,
86 | false, 1., color_red);
87 | sth_draw_text(stash, userData->droidBold, 24.0f * scale, dx, dy, "the lazy ", &dx, screenWidth, screenHeight,
88 | false, 1., color_red);
89 | sth_draw_text(stash, userData->droidRegular, 24.0f * scale, dx, dy, "dog.", &dx, screenWidth, screenHeight,
90 | false, 1., color_red);
91 | sth_end_draw(stash);
92 |
93 | dx = sx;
94 | dy += lh * 1.2f;
95 | sth_begin_draw(stash);
96 | float color_green[4] = {.0f, 1.f, 0.0f, 1.0f};
97 | sth_draw_text(stash, userData->droidRegular, 12.0f * scale, dx, dy,
98 | "Now is the time for all good men to come to the aid of the party.", &dx, screenWidth, screenHeight,
99 | false, 1., color_green);
100 | sth_vmetrics(stash, userData->droidItalic, 12 * scale, NULL, NULL, &lh);
101 | sth_end_draw(stash);
102 |
103 | dx = sx;
104 | dy += lh * 1.2f * 2;
105 | sth_begin_draw(stash);
106 | float color_yellow[4] = {1.0f, 1.0f, 0.0f, 1.0f};
107 | sth_draw_text(stash, userData->droidItalic, 18.0f * scale, dx, dy, "Ég get etið gler án þess að meiða mig.", &dx,
108 | screenWidth, screenHeight,
109 | false, 1., color_yellow);
110 | sth_vmetrics(stash, userData->droidItalic, 18 * scale, NULL, NULL, &lh);
111 | dx = sx;
112 | dy += lh * 1.2f;
113 |
114 | sth_draw_text(stash, userData->droidChinese, 18.0f * scale, dx, dy, "我可以吃屎,它真香。", &dx, screenWidth, screenHeight,
115 | false, 1., color_yellow);
116 | dx = sx;
117 | dy += lh * 1.2f * 2;
118 | sth_end_draw(stash);
119 | }
120 |
121 | void Shutdown(ESContext *esContext) {
122 | UserData *userData = (UserData *) (esContext->userData);
123 | sth_delete(userData->stash);
124 | delete userData->m_primRenderer;
125 | delete userData->m_renderCallbacks;
126 | }
127 |
128 | // https://github.com/google-research/tiny-differentiable-simulator
129 | // https://github.com/yarston/fontstash
130 | // https://github.com/hjanetzek/alfons
131 | // https://github.com/tangrams/fontstash-es
132 | int esMain(ESContext *esContext, int argc, char *argv[]) {
133 | esContext->userData = malloc(sizeof(UserData));
134 | esCreateWindow(esContext, "Hello Font", 1280, 720, ES_WINDOW_RGB);
135 | if (!Init(esContext, argc, argv)) {
136 | return GL_FALSE;
137 | }
138 | esRegisterShutdownFunc(esContext, Shutdown);
139 | esRegisterDrawFunc(esContext, Draw);
140 | return GL_TRUE;
141 | }
142 |
--------------------------------------------------------------------------------
/samples/Hello_Font/SourceHanSansCN-Normal.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/samples/Hello_Font/SourceHanSansCN-Normal.otf
--------------------------------------------------------------------------------
/samples/Hello_Font/tiny_font/tiny_font_stash.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2011 Andreas Krinke andreas.krinke@gmx.de
3 | // Copyright (c) 2009 Mikko Mononen memon@inside.org
4 | //
5 | // This software is provided 'as-is', without any express or implied
6 | // warranty. In no event will the authors be held liable for any damages
7 | // arising from the use of this software.
8 | // Permission is granted to anyone to use this software for any purpose,
9 | // including commercial applications, and to alter it and redistribute it
10 | // freely, subject to the following restrictions:
11 | // 1. The origin of this software must not be misrepresented; you must not
12 | // claim that you wrote the original software. If you use this software
13 | // in a product, an acknowledgment in the product documentation would be
14 | // appreciated but is not required.
15 | // 2. Altered source versions must be plainly marked as such, and must not be
16 | // misrepresented as being the original software.
17 | // 3. This notice may not be removed or altered from any source distribution.
18 | //
19 |
20 | #ifndef TINY_FONTSTASH_H
21 | #define TINY_FONTSTASH_H
22 |
23 | #define MAX_ROWS 128
24 | #define VERT_COUNT (16 * 128)
25 | #define INDEX_COUNT (VERT_COUNT * 2)
26 |
27 | struct vec2 {
28 | vec2(float x, float y) {
29 | p[0] = x;
30 | p[1] = y;
31 | }
32 |
33 | float p[2];
34 | };
35 |
36 | struct vec4 {
37 | vec4(float x, float y, float z, float w) {
38 | p[0] = x;
39 | p[1] = y;
40 | p[2] = z;
41 | p[3] = w;
42 | }
43 |
44 | float p[4];
45 | };
46 |
47 | typedef struct {
48 | vec4 position;
49 | vec4 colour;
50 | vec2 uv;
51 | } Vertex;
52 |
53 | struct sth_quad {
54 | float x0, y0, s0, t0;
55 | float x1, y1, s1, t1;
56 | };
57 |
58 | struct sth_row {
59 | short x, y, h;
60 | };
61 |
62 | struct sth_glyph {
63 | unsigned int codepoint;
64 | short size;
65 | struct sth_texture *texture;
66 | int x0_, y0, x1, y1;
67 | float xadv, xoff, yoff;
68 | int next;
69 | };
70 |
71 | struct sth_texture {
72 | union {
73 | void *m_userData;
74 | int m_userId;
75 | };
76 |
77 | unsigned char *m_texels;
78 |
79 | // TODO: replace rows with pointer
80 | struct sth_row rows[MAX_ROWS];
81 | int nrows;
82 | int nverts;
83 |
84 | Vertex newverts[VERT_COUNT];
85 | struct sth_texture *next;
86 | };
87 |
88 | struct RenderCallbacks {
89 | virtual ~RenderCallbacks() {}
90 |
91 | virtual void set_color_rgba(float color[4]) = 0;
92 |
93 | virtual void set_world_position(float pos[3]) = 0;
94 |
95 | virtual void set_world_orientation(float orn[4]) = 0;
96 |
97 | virtual void update_texture(sth_texture *texture, sth_glyph *glyph,
98 | int textureWidth, int textureHeight) = 0;
99 |
100 | virtual void render(sth_texture *texture) = 0;
101 | };
102 |
103 | struct sth_stash *sth_create(int cachew, int cacheh,
104 | RenderCallbacks *callbacks);
105 |
106 | int sth_add_font(struct sth_stash *stash, const char *path);
107 |
108 | int sth_add_font_from_memory(struct sth_stash *stash, unsigned char *buffer);
109 |
110 | int sth_add_bitmap_font(struct sth_stash *stash, int ascent, int descent,
111 | int line_gap);
112 |
113 | void sth_begin_draw(struct sth_stash *stash);
114 |
115 | void sth_end_draw(struct sth_stash *stash);
116 |
117 | void sth_draw_texture(struct sth_stash *stash, int idx, float size, float x,
118 | float y, int screenwidth, int screenheight, const char *s,
119 | float *dx, float colorRGBA[4]);
120 |
121 | void sth_flush_draw(struct sth_stash *stash);
122 |
123 | void sth_draw_text3D(struct sth_stash *stash, int idx, float fontSize, float x,
124 | float y, float z, const char *s, float *dx,
125 | float textScale, float colorRGBA[4], int bla);
126 |
127 | void sth_draw_text(struct sth_stash *stash, int idx, float size, float x,
128 | float y, const char *string, float *dx, int screenwidth,
129 | int screenheight, int measureOnly, float retinaScale,
130 | float colorRGBA[4]);
131 |
132 | inline void sth_draw_text(struct sth_stash *stash, int idx, float size, float x,
133 | float y, const char *string, float *dx,
134 | int screenwidth, int screenheight,
135 | int measureOnly = false, float retinaScale = 1.f) {
136 | float colorRGBA[4] = {1, 1, 1, 1};
137 | sth_draw_text(stash, idx, size, x, y, string, dx, screenwidth, screenheight,
138 | measureOnly, retinaScale, colorRGBA);
139 | }
140 |
141 | void sth_dim_text(struct sth_stash *stash, int idx, float size,
142 | const char *string, float *minx, float *miny, float *maxx,
143 | float *maxy);
144 |
145 | void sth_vmetrics(struct sth_stash *stash, int idx, float size, float *ascender,
146 | float *descender, float *lineh);
147 |
148 | void sth_delete(struct sth_stash *stash);
149 |
150 | #endif // TINY_FONTSTASH_H
151 |
--------------------------------------------------------------------------------
/samples/Hello_Font/tiny_font/tiny_fontstashcallbacks.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2020 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | #include "tiny_fontstashcallbacks.h"
17 | #include "tiny_primitive_renderer.h"
18 |
19 | #include
20 | #include "stb_image_write.h"
21 |
22 | static unsigned int s_indexData[INDEX_COUNT];
23 | static GLuint s_indexBuffer;
24 | static GLuint s_vertexArrayObject, s_vertexBuffer;
25 |
26 | OpenGLRenderCallbacks::OpenGLRenderCallbacks(
27 | TinyGLPrimitiveRenderer *primRender)
28 | : m_primRender2(primRender) {}
29 |
30 | OpenGLRenderCallbacks::~OpenGLRenderCallbacks() {}
31 |
32 | PrimInternalData *OpenGLRenderCallbacks::getData() {
33 | return m_primRender2->get_data();
34 | }
35 |
36 | InternalOpenGLRenderCallbacks::~InternalOpenGLRenderCallbacks() {}
37 |
38 | void InternalOpenGLRenderCallbacks::display2() {
39 | assert(glGetError() == GL_NO_ERROR);
40 | // glViewport(0,0,10,10);
41 |
42 | // const float timeScale = 0.008f;
43 | PrimInternalData *data = getData();
44 |
45 | glUseProgram(data->m_shaderProg);
46 | glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
47 | glBindVertexArray(s_vertexArrayObject);
48 |
49 | assert(glGetError() == GL_NO_ERROR);
50 |
51 | // glBindTexture(GL_TEXTURE_2D,m_texturehandle);
52 |
53 | assert(glGetError() == GL_NO_ERROR);
54 | float identity[16] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
55 | glUniformMatrix4fv(data->m_viewmatUniform, 1, false, identity);
56 | glUniformMatrix4fv(data->m_projMatUniform, 1, false, identity);
57 |
58 | vec2 p(0.f, 0.f); //?b?0.5f * sinf(timeValue), 0.5f * cosf(timeValue) );
59 | glUniform2fv(data->m_positionUniform, 1, (const GLfloat *) &p);
60 |
61 | assert(glGetError() == GL_NO_ERROR);
62 |
63 | glEnableVertexAttribArray(data->m_positionAttribute);
64 | assert(glGetError() == GL_NO_ERROR);
65 |
66 | glEnableVertexAttribArray(data->m_colourAttribute);
67 | assert(glGetError() == GL_NO_ERROR);
68 |
69 | glEnableVertexAttribArray(data->m_textureAttribute);
70 |
71 | glVertexAttribPointer(data->m_positionAttribute, 4, GL_FLOAT, GL_FALSE,
72 | sizeof(Vertex), (const GLvoid *) 0);
73 | glVertexAttribPointer(data->m_colourAttribute, 4, GL_FLOAT, GL_FALSE,
74 | sizeof(Vertex), (const GLvoid *) sizeof(vec4));
75 | glVertexAttribPointer(data->m_textureAttribute, 2, GL_FLOAT, GL_FALSE,
76 | sizeof(Vertex),
77 | (const GLvoid *) (sizeof(vec4) + sizeof(vec4)));
78 | assert(glGetError() == GL_NO_ERROR);
79 | /*
80 |
81 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffer);
82 | //glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
83 | int indexCount = 6;
84 | err = glGetError();
85 | assert(err==GL_NO_ERROR);
86 |
87 | glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
88 | err = glGetError();
89 | assert(err==GL_NO_ERROR);
90 | */
91 |
92 | // glutSwapBuffers();
93 | }
94 |
95 | void InternalOpenGLRenderCallbacks::update_texture(sth_texture *texture,
96 | sth_glyph *glyph,
97 | int textureWidth,
98 | int textureHeight) {
99 | assert(glGetError() == GL_NO_ERROR);
100 |
101 | if (glyph) {
102 | // Update texture (entire texture, could use glyph to update partial texture
103 | // using glTexSubImage2D)
104 | GLuint *gltexture = (GLuint *) texture->m_userData;
105 |
106 | glBindTexture(GL_TEXTURE_2D, *gltexture);
107 | glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
108 | assert(glGetError() == GL_NO_ERROR);
109 |
110 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, textureWidth, textureHeight, 0,
111 | GL_RED, GL_UNSIGNED_BYTE, texture->m_texels);
112 |
113 | assert(glGetError() == GL_NO_ERROR);
114 | } else {
115 | if (textureWidth && textureHeight) {
116 | GLuint *texId = new GLuint;
117 | texture->m_userData = texId;
118 |
119 | // create new texture
120 | glGenTextures(1, texId);
121 | assert(glGetError() == GL_NO_ERROR);
122 |
123 | glBindTexture(GL_TEXTURE_2D, *texId);
124 | texture->m_texels = (unsigned char *) malloc(textureWidth * textureHeight);
125 | memset(texture->m_texels, 0, textureWidth * textureHeight);
126 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, textureWidth, textureHeight, 0,
127 | GL_RED, GL_UNSIGNED_BYTE, texture->m_texels);
128 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
129 | GL_LINEAR_MIPMAP_LINEAR);
130 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
131 | assert(glGetError() == GL_NO_ERROR);
132 |
133 | ////////////////////////////
134 | // create the other data
135 | {
136 | glGenVertexArrays(1, &s_vertexArrayObject);
137 | glBindVertexArray(s_vertexArrayObject);
138 |
139 | glGenBuffers(1, &s_vertexBuffer);
140 | glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
141 | glBufferData(GL_ARRAY_BUFFER, VERT_COUNT * sizeof(Vertex),
142 | texture->newverts, GL_DYNAMIC_DRAW);
143 | assert(glGetError() == GL_NO_ERROR);
144 |
145 | for (int i = 0; i < INDEX_COUNT; i++) {
146 | s_indexData[i] = i;
147 | }
148 |
149 | glGenBuffers(1, &s_indexBuffer);
150 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s_indexBuffer);
151 | glBufferData(GL_ELEMENT_ARRAY_BUFFER, INDEX_COUNT * sizeof(int),
152 | s_indexData, GL_STATIC_DRAW);
153 |
154 | assert(glGetError() == GL_NO_ERROR);
155 | }
156 | } else {
157 | // delete texture
158 | if (texture->m_userData) {
159 | GLuint *id = (GLuint *) texture->m_userData;
160 |
161 | glDeleteTextures(1, id);
162 | // delete id;
163 | delete id; // texture->m_userData;
164 | texture->m_userData = 0;
165 | }
166 | }
167 | }
168 | }
169 |
170 | void InternalOpenGLRenderCallbacks::render(sth_texture *texture) {
171 | display2();
172 |
173 | GLuint *texId = (GLuint *) texture->m_userData;
174 |
175 | assert(glGetError() == GL_NO_ERROR);
176 |
177 | glActiveTexture(GL_TEXTURE0);
178 | assert(glGetError() == GL_NO_ERROR);
179 |
180 | glBindTexture(GL_TEXTURE_2D, *texId);
181 | bool useFiltering = false;
182 | if (useFiltering) {
183 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
184 | GL_LINEAR_MIPMAP_LINEAR);
185 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
186 | } else {
187 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
188 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
189 | }
190 | assert(glGetError() == GL_NO_ERROR);
191 | glBindBuffer(GL_ARRAY_BUFFER, s_vertexBuffer);
192 | glBindVertexArray(s_vertexArrayObject);
193 | glBufferData(GL_ARRAY_BUFFER, texture->nverts * sizeof(Vertex),
194 | &texture->newverts[0].position.p[0], GL_DYNAMIC_DRAW);
195 |
196 | assert(glGetError() == GL_NO_ERROR);
197 |
198 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s_indexBuffer);
199 |
200 | // glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
201 | int indexCount = texture->nverts;
202 | assert(glGetError() == GL_NO_ERROR);
203 |
204 | glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
205 | assert(glGetError() == GL_NO_ERROR);
206 |
207 | glBindVertexArray(0);
208 |
209 | glBindBuffer(GL_ARRAY_BUFFER, 0);
210 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
211 | // glDisableVertexAttribArray(m_textureAttribute);
212 | glUseProgram(0);
213 | }
214 |
215 | void dumpTextureToPng(int textureWidth, int textureHeight,
216 | const char *fileName) {
217 | glPixelStorei(GL_PACK_ALIGNMENT, 1);
218 | unsigned char *pixels = (unsigned char *) malloc(textureWidth * textureHeight);
219 | glReadPixels(0, 0, textureWidth, textureHeight, GL_RED, GL_UNSIGNED_BYTE,
220 | pixels);
221 | // swap the pixels
222 | unsigned char *tmp = (unsigned char *) malloc(textureWidth);
223 | for (int j = 0; j < textureHeight; j++) {
224 | pixels[j * textureWidth + j] = 255;
225 | }
226 | if (0) {
227 | for (int j = 0; j < textureHeight / 2; j++) {
228 | for (int i = 0; i < textureWidth; i++) {
229 | tmp[i] = pixels[j * textureWidth + i];
230 | pixels[j * textureWidth + i] =
231 | pixels[(textureHeight - j - 1) * textureWidth + i];
232 | pixels[(textureHeight - j - 1) * textureWidth + i] = tmp[i];
233 | }
234 | }
235 | }
236 |
237 | int comp = 1; // 1=Y
238 | stbi_write_png(fileName, textureWidth, textureHeight, comp, pixels,
239 | textureWidth);
240 |
241 | free(pixels);
242 | }
243 |
--------------------------------------------------------------------------------
/samples/Hello_Font/tiny_font/tiny_fontstashcallbacks.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef TINY_OPENGL_FONTSTASH_CALLBACKS_H
16 | #define TINY_OPENGL_FONTSTASH_CALLBACKS_H
17 |
18 | #include "tiny_font_stash.h"
19 |
20 | struct PrimInternalData;
21 |
22 | class TinyGLPrimitiveRenderer;
23 |
24 | struct InternalOpenGLRenderCallbacks : public RenderCallbacks {
25 | virtual PrimInternalData *getData() = 0;
26 |
27 | virtual ~InternalOpenGLRenderCallbacks();
28 |
29 | virtual void update_texture(sth_texture *texture, sth_glyph *glyph,
30 | int textureWidth, int textureHeight);
31 |
32 | virtual void render(sth_texture *texture);
33 |
34 | void display2();
35 | };
36 |
37 | void dumpTextureToPng(int screenWidth, int screenHeight, const char *fileName);
38 |
39 | struct SimpleOpenGL2RenderCallbacks : public InternalOpenGLRenderCallbacks {
40 | PrimInternalData *m_data;
41 |
42 | virtual PrimInternalData *getData() { return m_data; }
43 |
44 | SimpleOpenGL2RenderCallbacks(PrimInternalData *data) : m_data(data) {}
45 |
46 | virtual ~SimpleOpenGL2RenderCallbacks() {}
47 | };
48 |
49 | struct OpenGLRenderCallbacks : public InternalOpenGLRenderCallbacks {
50 | TinyGLPrimitiveRenderer *m_primRender2;
51 |
52 | virtual PrimInternalData *getData();
53 |
54 | virtual void set_world_position(float pos[3]) {}
55 |
56 | virtual void set_world_orientation(float orn[4]) {}
57 |
58 | virtual void set_color_rgba(float color[4]) {}
59 |
60 | OpenGLRenderCallbacks(TinyGLPrimitiveRenderer *primRender);
61 |
62 | virtual ~OpenGLRenderCallbacks();
63 | };
64 |
65 | #endif // TINY_OPENGL_FONTSTASH_CALLBACKS_H
66 |
--------------------------------------------------------------------------------
/samples/Hello_Font/tiny_font/tiny_load_shader.cpp:
--------------------------------------------------------------------------------
1 | // Copyright 2020 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include "tiny_load_shader.h"
16 | #include
17 | #include
18 | #include
19 |
20 | // Load the shader from the source text
21 | void gltLoadShaderSrc(const char *szShaderSrc, GLuint shader) {
22 | GLchar *fsStringPtr[1];
23 |
24 | fsStringPtr[0] = (GLchar *) szShaderSrc;
25 | glShaderSource(shader, 1, (const GLchar **) fsStringPtr, NULL);
26 | }
27 |
28 | GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg) {
29 | assert(glGetError() == GL_NO_ERROR);
30 |
31 | // Temporary Shader objects
32 | GLuint hVertexShader;
33 | GLuint hFragmentShader;
34 | GLuint hReturn = 0;
35 | GLint testVal;
36 |
37 | // Create shader objects
38 | hVertexShader = glCreateShader(GL_VERTEX_SHADER);
39 | hFragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
40 |
41 | gltLoadShaderSrc(szVertexProg, hVertexShader);
42 | gltLoadShaderSrc(szFragmentProg, hFragmentShader);
43 |
44 | // Compile them
45 | glCompileShader(hVertexShader);
46 | assert(glGetError() == GL_NO_ERROR);
47 |
48 | glGetShaderiv(hVertexShader, GL_COMPILE_STATUS, &testVal);
49 | if (testVal == GL_FALSE) {
50 | char temp[256] = "";
51 | glGetShaderInfoLog(hVertexShader, 256, NULL, temp);
52 | fprintf(stderr, "Compile failed:\n%s\n", temp);
53 | assert(0);
54 | return 0;
55 | glDeleteShader(hVertexShader);
56 | glDeleteShader(hFragmentShader);
57 | return (GLuint) 0;
58 | }
59 |
60 | assert(glGetError() == GL_NO_ERROR);
61 |
62 | glCompileShader(hFragmentShader);
63 | assert(glGetError() == GL_NO_ERROR);
64 |
65 | glGetShaderiv(hFragmentShader, GL_COMPILE_STATUS, &testVal);
66 | if (testVal == GL_FALSE) {
67 | char temp[256] = "";
68 | glGetShaderInfoLog(hFragmentShader, 256, NULL, temp);
69 | fprintf(stderr, "Compile failed:\n%s\n", temp);
70 | assert(0);
71 | exit(EXIT_FAILURE);
72 | glDeleteShader(hVertexShader);
73 | glDeleteShader(hFragmentShader);
74 | return (GLuint) 0;
75 | }
76 |
77 | assert(glGetError() == GL_NO_ERROR);
78 |
79 | // Check for errors
80 |
81 | // Link them - assuming it works...
82 | hReturn = glCreateProgram();
83 | glAttachShader(hReturn, hVertexShader);
84 | glAttachShader(hReturn, hFragmentShader);
85 |
86 | glLinkProgram(hReturn);
87 |
88 | // These are no longer needed
89 | glDeleteShader(hVertexShader);
90 | glDeleteShader(hFragmentShader);
91 |
92 | // Make sure link worked too
93 | glGetProgramiv(hReturn, GL_LINK_STATUS, &testVal);
94 | if (testVal == GL_FALSE) {
95 | GLsizei maxLen = 4096;
96 | GLchar infoLog[4096];
97 | GLsizei actualLen;
98 |
99 | glGetProgramInfoLog(hReturn, maxLen, &actualLen, infoLog);
100 |
101 | printf("Warning/Error in GLSL shader:\n");
102 | printf("%s\n", infoLog);
103 | glDeleteProgram(hReturn);
104 | return (GLuint) 0;
105 | }
106 |
107 | return hReturn;
108 | }
109 |
--------------------------------------------------------------------------------
/samples/Hello_Font/tiny_font/tiny_load_shader.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef TINY_LOAD_SHADER_H
16 | #define TINY_LOAD_SHADER_H
17 |
18 | #include "tiny_opengl_include.h"
19 |
20 | #ifdef __cplusplus
21 | extern "C" {
22 | #endif //__cplusplus
23 |
24 | GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif //__cplusplus
29 |
30 | #endif // TINY_LOAD_SHADER_H
31 |
--------------------------------------------------------------------------------
/samples/Hello_Font/tiny_font/tiny_opengl_include.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012 Advanced Micro Devices, Inc.
3 |
4 | This software is provided 'as-is', without any express or implied warranty.
5 | In no event will the authors be held liable for any damages arising from the use
6 | of this software. Permission is granted to anyone to use this software for any
7 | purpose, including commercial applications, and to alter it and redistribute it
8 | freely, subject to the following restrictions:
9 |
10 | 1. The origin of this software must not be misrepresented; you must not claim
11 | that you wrote the original software. If you use this software in a product, an
12 | acknowledgment in the product documentation would be appreciated but is not
13 | required.
14 | 2. Altered source versions must be plainly marked as such, and must not be
15 | misrepresented as being the original software.
16 | 3. This notice may not be removed or altered from any source distribution.
17 | */
18 | // Originally written by Erwin Coumans
19 |
20 | #ifndef TINY_OPENGL_INCLUDE_H
21 | #define TINY_OPENGL_INCLUDE_H
22 |
23 | #ifdef __APPLE__
24 | //#include
25 | #include
26 | #else
27 | //#include
28 | #include
29 | #include
30 | #include
31 |
32 | #endif
33 |
34 | #endif // TINY_OPENGL_INCLUDE_H
35 |
--------------------------------------------------------------------------------
/samples/Hello_Font/tiny_font/tiny_primitive_renderer.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 Google LLC
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef _GL_PRIMITIVE_RENDERER_H
16 | #define _GL_PRIMITIVE_RENDERER_H
17 |
18 | #include "tiny_opengl_include.h"
19 |
20 | struct PrimInternalData {
21 | GLuint m_shaderProg;
22 | GLint m_viewmatUniform;
23 | GLint m_projMatUniform;
24 | GLint m_positionUniform;
25 | GLint m_colourAttribute;
26 | GLint m_positionAttribute;
27 | GLint m_textureAttribute;
28 | GLuint m_vertexBuffer;
29 | GLuint m_vertexBuffer2;
30 |
31 | GLuint m_vertexArrayObject;
32 | GLuint m_vertexArrayObject2;
33 |
34 | GLuint m_indexBuffer;
35 | GLuint m_indexBuffer2;
36 | GLuint m_texturehandle;
37 | };
38 |
39 | struct PrimVec2 {
40 | PrimVec2() {}
41 |
42 | PrimVec2(float x, float y) {
43 | p[0] = x;
44 | p[1] = y;
45 | }
46 |
47 | float p[2];
48 | };
49 |
50 | struct PrimVec4 {
51 | PrimVec4() {}
52 |
53 | PrimVec4(float x, float y, float z, float w) {
54 | p[0] = x;
55 | p[1] = y;
56 | p[2] = z;
57 | p[3] = w;
58 | }
59 |
60 | float p[4];
61 | };
62 |
63 | struct PrimVertex {
64 | PrimVertex(const PrimVec4 &p, const PrimVec4 &c, const PrimVec2 &u)
65 | : position(p), colour(c), uv(u) {}
66 |
67 | PrimVertex() {}
68 |
69 | PrimVec4 position;
70 | PrimVec4 colour;
71 | PrimVec2 uv;
72 | };
73 |
74 | class TinyGLPrimitiveRenderer {
75 | int m_screenWidth;
76 | int m_screenHeight;
77 |
78 | struct PrimInternalData *m_data;
79 | struct PrimInternalData2 *m_data2;
80 |
81 | void load_buffer_data();
82 |
83 | public:
84 | TinyGLPrimitiveRenderer(int screenWidth, int screenHeight);
85 |
86 | virtual ~TinyGLPrimitiveRenderer();
87 |
88 | void draw_rect(float x0, float y0, float x1, float y1, float color[4]);
89 |
90 | void draw_textured_tect(float x0, float y0, float x1, float y1,
91 | float color[4], float u0, float v0, float u1,
92 | float v1, int useRGBA = 0);
93 |
94 | void draw_textured_rect_3d(const PrimVertex &v0, const PrimVertex &v1,
95 | const PrimVertex &v2, const PrimVertex &v3,
96 | float viewMat[16], float projMat[16],
97 | bool useRGBA = true);
98 |
99 | void draw_line(); // float from[4], float to[4], float color[4]);
100 | void set_screen_size(int width, int height);
101 |
102 | int get_screen_width() { return m_screenWidth; }
103 |
104 | int get_screen_height() { return m_screenHeight; }
105 |
106 | void draw_textured_rect2(float x0, float y0, float x1, float y1,
107 | float color[4], float u0, float v0, float u1,
108 | float v1, int useRGBA = 0);
109 |
110 | void draw_textured_rect2a(float x0, float y0, float x1, float y1,
111 | float color[4], float u0, float v0, float u1,
112 | float v1, int useRGBA = 0);
113 |
114 | void flushBatchedRects();
115 |
116 | void draw_textured_rect_3d2_text(bool useRGBA = true);
117 |
118 | void draw_textured_rect_3d2(PrimVertex *vertices, int numVertices,
119 | bool useRGBA = true);
120 |
121 | PrimInternalData *get_data() { return m_data; }
122 | };
123 |
124 | #endif //_GL_PRIMITIVE_RENDERER_H
125 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cpuimage/TinyText/efb62630180c6e0558b696fcb5bbb5f13f545623/screenshot.png
--------------------------------------------------------------------------------