Replace glew with glad with vulkan support
This commit is contained in:
parent
85984d143a
commit
3f0eb215f7
@ -30,7 +30,6 @@ option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
|
||||
option(USE_SYSTEM_ANGELSCRIPT "Use system angelscript instead of built-in angelscript. If you enable this option, make sure to use a compatible version." OFF)
|
||||
option(USE_SYSTEM_ENET "Use system ENet instead of the built-in version, when available." ON)
|
||||
option(USE_IPV6 "Allow create or connect to game server with IPv6 address, system enet will not be used." ON)
|
||||
option(USE_SYSTEM_GLEW "Use system GLEW instead of the built-in version, when available." ON)
|
||||
option(USE_SYSTEM_WIIUSE "Use system WiiUse instead of the built-in version, when available." OFF)
|
||||
option(USE_SQLITE3 "Use sqlite to manage server stats and ban list." ON)
|
||||
|
||||
@ -203,32 +202,9 @@ else()
|
||||
endif()
|
||||
|
||||
# Find system GLEW library or build it if missing
|
||||
if (APPLE AND NOT IOS)
|
||||
find_library(GLEW_LIBRARY NAMES glew libglew libGLEW)
|
||||
find_path(GLEW_INCLUDEDIR NAMES GL/glew.h glew.h PATHS)
|
||||
if (NOT GLEW_LIBRARY OR NOT GLEW_INCLUDEDIR)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
|
||||
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/glew/include")
|
||||
set(GLEW_LIBRARIES "glew")
|
||||
else()
|
||||
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
|
||||
include_directories(${GLEW_INCLUDEDIR})
|
||||
MESSAGE(STATUS "Use system GLEW: ${GLEW_LIBRARIES}")
|
||||
endif()
|
||||
elseif(NOT USE_GLES2 AND NOT SERVER_ONLY)
|
||||
add_definitions(-DGLEW_NO_GLU)
|
||||
if((UNIX AND NOT APPLE) AND USE_SYSTEM_GLEW)
|
||||
pkg_check_modules(GLEW glew>=2.1)
|
||||
endif()
|
||||
|
||||
if(GLEW_FOUND)
|
||||
include_directories(${GLEW_INCLUDE_DIRS})
|
||||
else()
|
||||
# Fallback to built-in version silently
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
|
||||
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/glew/include")
|
||||
set(GLEW_LIBRARIES "glew")
|
||||
endif()
|
||||
if(NOT SERVER_ONLY)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/graphics_engine")
|
||||
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/graphics_engine/include")
|
||||
endif()
|
||||
|
||||
if (NOT SERVER_ONLY)
|
||||
@ -405,12 +381,6 @@ if (NOT SERVER_ONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
if(NOT USE_GLES2 AND NOT SERVER_ONLY)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(USE_LIBBFD)
|
||||
find_package(Libbfd)
|
||||
if(LIBBFD_FOUND)
|
||||
@ -637,12 +607,8 @@ else()
|
||||
endif()
|
||||
|
||||
if(NOT SERVER_ONLY)
|
||||
if(NOT USE_GLES2)
|
||||
target_link_libraries(supertuxkart ${OPENGL_gl_LIBRARY} ${GLEW_LIBRARIES})
|
||||
elseif (IOS)
|
||||
if (IOS)
|
||||
target_link_libraries(supertuxkart "-framework QuartzCore -framework CoreGraphics -framework AVFoundation -framework AudioToolbox -framework Metal -framework GameController -framework OpenGLES -framework UIKit -framework CoreAudio -framework CoreMotion -framework Foundation -framework GLKit")
|
||||
else()
|
||||
target_link_libraries(supertuxkart GLESv2)
|
||||
endif()
|
||||
|
||||
target_link_libraries(supertuxkart
|
||||
@ -655,6 +621,7 @@ if(NOT SERVER_ONLY)
|
||||
${SDL2_LIBRARY}
|
||||
${SHEENBIDI_LIBRARY}
|
||||
graphics_utils
|
||||
graphics_engine
|
||||
tinygettext)
|
||||
endif()
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
# CMakeLists.txt - glew
|
||||
|
||||
if (NOT SERVER_ONLY)
|
||||
include_directories("include")
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch x86_64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -F/Library/Frameworks")
|
||||
endif()
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
add_library(glew STATIC
|
||||
src/glew.c
|
||||
src/glewinfo.c
|
||||
)
|
||||
|
||||
target_link_libraries(glew ${OPENGL_gl_LIBRARY})
|
||||
|
||||
endif()
|
@ -1,73 +0,0 @@
|
||||
The OpenGL Extension Wrangler Library
|
||||
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
||||
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
Copyright (C) 2002, Lev Povalahev
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The name of the author may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Mesa 3-D graphics library
|
||||
Version: 7.0
|
||||
|
||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Copyright (c) 2007 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
28581
lib/glew/src/glew.c
28581
lib/glew/src/glew.c
File diff suppressed because it is too large
Load Diff
16881
lib/glew/src/glewinfo.c
16881
lib/glew/src/glewinfo.c
File diff suppressed because it is too large
Load Diff
5
lib/graphics_engine/CMakeLists.txt
Normal file
5
lib/graphics_engine/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/graphics_engine/include")
|
||||
add_library(graphics_engine STATIC
|
||||
src/gl.c
|
||||
src/vulkan.c
|
||||
)
|
290
lib/graphics_engine/include/KHR/khrplatform.h
Normal file
290
lib/graphics_engine/include/KHR/khrplatform.h
Normal file
@ -0,0 +1,290 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* The master copy of khrplatform.h is maintained in the Khronos EGL
|
||||
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
|
||||
* The last semantic modification to khrplatform.h was at commit ID:
|
||||
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by filing pull requests or issues on
|
||||
* the EGL Registry repository linked above.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
|
||||
# define KHRONOS_STATIC 1
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(KHRONOS_STATIC)
|
||||
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
|
||||
* header compatible with static linking. */
|
||||
# define KHRONOS_APICALL
|
||||
#elif defined(_WIN32)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
17268
lib/graphics_engine/include/glad/gl.h
Normal file
17268
lib/graphics_engine/include/glad/gl.h
Normal file
File diff suppressed because one or more lines are too long
10896
lib/graphics_engine/include/glad/vulkan.h
Normal file
10896
lib/graphics_engine/include/glad/vulkan.h
Normal file
File diff suppressed because one or more lines are too long
82
lib/graphics_engine/include/vk_platform.h
Normal file
82
lib/graphics_engine/include/vk_platform.h
Normal file
@ -0,0 +1,82 @@
|
||||
/* */
|
||||
/* File: vk_platform.h */
|
||||
/* */
|
||||
/*
|
||||
** Copyright (c) 2014-2020 The Khronos Group Inc.
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef VK_PLATFORM_H_
|
||||
#define VK_PLATFORM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
***************************************************************************************************
|
||||
* Platform-specific directives and type declarations
|
||||
***************************************************************************************************
|
||||
*/
|
||||
|
||||
/* Platform-specific calling convention macros.
|
||||
*
|
||||
* Platforms should define these so that Vulkan clients call Vulkan commands
|
||||
* with the same calling conventions that the Vulkan implementation expects.
|
||||
*
|
||||
* VKAPI_ATTR - Placed before the return type in function declarations.
|
||||
* Useful for C++11 and GCC/Clang-style function attribute syntax.
|
||||
* VKAPI_CALL - Placed after the return type in function declarations.
|
||||
* Useful for MSVC-style calling convention syntax.
|
||||
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
|
||||
*
|
||||
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
|
||||
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
/* On Windows, Vulkan commands use the stdcall convention */
|
||||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL __stdcall
|
||||
#define VKAPI_PTR VKAPI_CALL
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
||||
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
||||
/* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
|
||||
/* calling convention, i.e. float parameters are passed in registers. This */
|
||||
/* is true even if the rest of the application passes floats on the stack, */
|
||||
/* as it does by default when compiling for the armeabi-v7a NDK ABI. */
|
||||
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR VKAPI_ATTR
|
||||
#else
|
||||
/* On other platforms, use the default calling convention */
|
||||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(VK_NO_STDINT_H)
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif /* !defined(VK_NO_STDINT_H) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
10927
lib/graphics_engine/src/gl.c
Normal file
10927
lib/graphics_engine/src/gl.c
Normal file
File diff suppressed because it is too large
Load Diff
2194
lib/graphics_engine/src/vulkan.c
Normal file
2194
lib/graphics_engine/src/vulkan.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,11 +8,6 @@ if(NOT SERVER_ONLY)
|
||||
"${PNG_INCLUDE_DIRS}"
|
||||
"${ZLIB_INCLUDE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
|
||||
if(NOT USE_GLES2)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
else()
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
|
@ -205,7 +205,10 @@ define out. */
|
||||
/** On some systems there is no support for the dynamic extension of OpenGL
|
||||
via function pointers such that this has to be undef'ed. */
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
#if !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_SOLARIS_PLATFORM_)
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
// SDL2 seems to handle this well in OSX
|
||||
#define _IRR_OPENGL_USE_EXTPOINTER_
|
||||
#elif !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_SOLARIS_PLATFORM_)
|
||||
#define _IRR_OPENGL_USE_EXTPOINTER_
|
||||
#endif
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "COpenGLExtensionHandler.h"
|
||||
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "glad/gl.h"
|
||||
|
||||
extern bool GLContextDebugBit;
|
||||
|
||||
@ -391,7 +392,8 @@ start:
|
||||
if (Window)
|
||||
{
|
||||
Context = SDL_GL_CreateContext(Window);
|
||||
if (Context && versionCorrect(3, 0)) return;
|
||||
if (Context && gladLoadGLES2((GLADloadfunc)SDL_GL_GetProcAddress) != 0 &&
|
||||
versionCorrect(3, 0)) return;
|
||||
}
|
||||
|
||||
#else
|
||||
@ -416,7 +418,8 @@ start:
|
||||
if (Window)
|
||||
{
|
||||
Context = SDL_GL_CreateContext(Window);
|
||||
if (Context && versionCorrect(4, 3)) return;
|
||||
if (Context && gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress) != 0 &&
|
||||
versionCorrect(4, 3)) return;
|
||||
}
|
||||
|
||||
if (Context)
|
||||
@ -440,7 +443,8 @@ start:
|
||||
if (Window)
|
||||
{
|
||||
Context = SDL_GL_CreateContext(Window);
|
||||
if (Context && versionCorrect(3, 3)) return;
|
||||
if (Context && gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress) != 0 &&
|
||||
versionCorrect(3, 3)) return;
|
||||
}
|
||||
|
||||
if (Context)
|
||||
@ -464,7 +468,8 @@ start:
|
||||
if (Window)
|
||||
{
|
||||
Context = SDL_GL_CreateContext(Window);
|
||||
if (Context && versionCorrect(3, 1)) return;
|
||||
if (Context && gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress) != 0 &&
|
||||
versionCorrect(3, 1)) return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -500,7 +505,11 @@ legacy:
|
||||
if (Window)
|
||||
{
|
||||
Context = SDL_GL_CreateContext(Window);
|
||||
if (Context) return;
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
if (Context && gladLoadGLES2((GLADloadfunc)SDL_GL_GetProcAddress) != 0) return;
|
||||
#else
|
||||
if (Context && gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress) != 0) return;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (CreationParams.Doublebuffer)
|
||||
|
@ -22,13 +22,6 @@
|
||||
#include "os.h"
|
||||
#include "IrrlichtDevice.h"
|
||||
|
||||
#ifdef IOS_STK
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
||||
#include "CIrrDeviceWayland.h"
|
||||
#endif
|
||||
|
@ -27,6 +27,8 @@ namespace irr
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if !defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
@ -35,14 +37,16 @@ namespace irr
|
||||
#include "stk_android_native_app_glue.h"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "libGLESv2.lib")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "CNullDriver.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "EDriverFeatures.h"
|
||||
#include "fast_atof.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "libGLESv2.lib")
|
||||
#endif
|
||||
#include "COGLES2ExtensionHandler.h"
|
||||
|
||||
class ContextManagerEGL;
|
||||
|
@ -10,6 +10,11 @@
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include "glad/gl.h"
|
||||
#else
|
||||
|
||||
#ifdef IOS_STK
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
@ -20,6 +25,8 @@ typedef char GLchar;
|
||||
#if defined(_IRR_OGLES2_USE_EXTPOINTER_)
|
||||
#include "gles2-ext.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#include "os.h"
|
||||
#include "EDriverFeatures.h"
|
||||
|
@ -12,7 +12,9 @@
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#ifdef IOS_STK
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include "glad/gl.h"
|
||||
#elif defined (IOS_STK)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
|
@ -12,7 +12,9 @@
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#ifdef IOS_STK
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include "glad/gl.h"
|
||||
#elif defined (IOS_STK)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
|
@ -116,7 +116,15 @@ void COpenGLExtensionHandler::dump() const
|
||||
void COpenGLExtensionHandler::dumpFramebufferFormats() const
|
||||
{
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
typedef HDC (APIENTRY * wglGetCurrentDC_func)();
|
||||
wglGetCurrentDC_func wglGetCurrentDC_ptr = NULL;
|
||||
wglGetCurrentDC_ptr = (wglGetCurrentDC_func)SDL_GL_GetProcAddress("wglGetCurrentDC");
|
||||
HDC hdc=wglGetCurrentDC_ptr();
|
||||
#else
|
||||
HDC hdc=wglGetCurrentDC();
|
||||
#endif
|
||||
|
||||
core::stringc wglExtensions;
|
||||
#ifdef WGL_ARB_extensions_string
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
@ -382,11 +390,11 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer, bool useCoreCon
|
||||
StencilBuffer=stencilBuffer;
|
||||
|
||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define IRR_OGL_LOAD_EXTENSION(x) wglGetProcAddress(reinterpret_cast<const char*>(x))
|
||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
#define IRR_OGL_LOAD_EXTENSION(x) SDL_GL_GetProcAddress(reinterpret_cast<const char*>(x))
|
||||
#else
|
||||
#elif defined (_IRR_WINDOWS_API_)
|
||||
#define IRR_OGL_LOAD_EXTENSION(x) wglGetProcAddress(reinterpret_cast<const char*>(x))
|
||||
|
||||
// Accessing the correct function is quite complex
|
||||
// All libraries should support the ARB version, however
|
||||
// since GLX 1.4 the non-ARB version is the official one
|
||||
|
@ -14,17 +14,13 @@
|
||||
#include "os.h"
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#define GLX_GLXEXT_LEGACY 1
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#define GLX_GLXEXT_PROTOTYPES 1
|
||||
#endif
|
||||
#define NO_SDL_GLEXT
|
||||
#include <SDL_video.h>
|
||||
#include <SDL_opengl.h>
|
||||
#include "glext.h"
|
||||
#include "glad/gl.h"
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#elif defined(_IRR_WINDOWS_API_)
|
||||
// include windows headers for HWND
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
@ -2366,9 +2362,9 @@ inline void COpenGLExtensionHandler::extGlProgramParameteri(GLhandleARB program,
|
||||
if (queryFeature(EVDF_GEOMETRY_SHADER))
|
||||
{
|
||||
if (pGlProgramParameteriARB)
|
||||
pGlProgramParameteriARB(program, pname, value);
|
||||
pGlProgramParameteriARB((size_t)program, pname, value);
|
||||
else if (pGlProgramParameteriEXT)
|
||||
pGlProgramParameteriEXT(program, pname, value);
|
||||
pGlProgramParameteriEXT((size_t)program, pname, value);
|
||||
}
|
||||
#elif defined(GL_ARB_geometry_shader4)
|
||||
glProgramParameteriARB((size_t)program, pname, value);
|
||||
|
@ -8,6 +8,14 @@
|
||||
#include "IrrCompileConfig.h"
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include "glad/gl.h"
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#else
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -30,6 +38,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "IMaterialRenderer.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
|
@ -13,17 +13,21 @@
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include "glad/gl.h"
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#elif _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#elif defined(_IRR_OSX_PLATFORM_)
|
||||
#define GL_SILENCE_DEPRECATION
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#define NO_SDL_GLEXT
|
||||
#include <SDL_video.h>
|
||||
#include <SDL_opengl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
@ -16,7 +16,15 @@
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include "glad/gl.h"
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#elif defined (_IRR_WINDOWS_API_)
|
||||
// include windows headers for HWND
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -27,10 +35,6 @@
|
||||
#elif defined(_IRR_OSX_PLATFORM_)
|
||||
#define GL_SILENCE_DEPRECATION
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#define NO_SDL_GLEXT
|
||||
#include <SDL_video.h>
|
||||
#include <SDL_opengl.h>
|
||||
#else
|
||||
#if defined(_IRR_OSX_PLATFORM_)
|
||||
#include <OpenGL/gl.h>
|
||||
|
@ -110,15 +110,15 @@ CPUParticleManager::GLParticle::GLParticle(bool flips)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 20, 0);
|
||||
glVertexAttribDivisorARB(0, 1);
|
||||
glVertexAttribDivisor(0, 1);
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, 20,
|
||||
(void*)12);
|
||||
glVertexAttribDivisorARB(1, 1);
|
||||
glVertexAttribDivisor(1, 1);
|
||||
glEnableVertexAttribArray(2);
|
||||
glVertexAttribPointer(2, 2, GL_HALF_FLOAT, GL_FALSE, 20,
|
||||
(void*)16);
|
||||
glVertexAttribDivisorARB(2, 1);
|
||||
glVertexAttribDivisor(2, 1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_particle_quad);
|
||||
glEnableVertexAttribArray(4);
|
||||
glVertexAttribPointer(4, 2, GL_FLOAT, GL_FALSE, 16, 0);
|
||||
@ -129,7 +129,7 @@ CPUParticleManager::GLParticle::GLParticle(bool flips)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, STKParticle::getFlipsBuffer());
|
||||
glEnableVertexAttribArray(6);
|
||||
glVertexAttribPointer(6, 1, GL_FLOAT, GL_FALSE, 4, 0);
|
||||
glVertexAttribDivisorARB(6, 1);
|
||||
glVertexAttribDivisor(6, 1);
|
||||
}
|
||||
glBindVertexArray(0);
|
||||
} // GLParticle
|
||||
|
@ -19,76 +19,12 @@
|
||||
#define GL_HEADER_HPP
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
|
||||
#define GLEW_STATIC
|
||||
|
||||
extern "C" {
|
||||
#if defined(__APPLE__)
|
||||
# define GL_SILENCE_DEPRECATION
|
||||
# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
|
||||
#endif
|
||||
#if !defined(USE_GLES2)
|
||||
# include <GL/glew.h>
|
||||
// This is a workaround for mesa drivers that now use __gl_glext_h_ instead of
|
||||
// __glext_h_ in header file which is not defined in current glew version
|
||||
# define __gl_glext_h_
|
||||
#endif
|
||||
}
|
||||
#include <cinttypes>
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
# define __gl2_h_
|
||||
#if defined(__APPLE__)
|
||||
# include <OpenGLES/ES3/gl.h>
|
||||
# include <OpenGLES/ES3/glext.h>
|
||||
# include <OpenGLES/ES2/glext.h>
|
||||
#include "glad/gl.h"
|
||||
#else
|
||||
# include <GLES3/gl3.h>
|
||||
# include <GLES3/gl3ext.h>
|
||||
# include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
# define glVertexAttribDivisorARB glVertexAttribDivisor
|
||||
#elif defined(__APPLE__)
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/gl3.h>
|
||||
# define OGL32CTX
|
||||
# ifdef GL_ARB_instanced_arrays
|
||||
# ifdef glVertexAttribDivisor
|
||||
# undef glVertexAttribDivisor
|
||||
# endif
|
||||
# define glVertexAttribDivisor glVertexAttribDivisorARB
|
||||
# endif
|
||||
# ifndef GL_TEXTURE_SWIZZLE_RGBA
|
||||
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
|
||||
# endif
|
||||
#elif defined(WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define DEBUG_OUTPUT_DECLARED
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
#define GL_BGRA 0x80E1
|
||||
#define GL_BGR 0x80E0
|
||||
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
|
||||
#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
|
||||
#endif
|
||||
#ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
typedef unsigned int GLuint;
|
||||
typedef int GLint;
|
||||
typedef unsigned int GLsync;
|
||||
typedef unsigned int GLenum;
|
||||
|
||||
typedef unsigned int GLuint;
|
||||
typedef int GLint;
|
||||
typedef unsigned int GLsync;
|
||||
typedef unsigned int GLenum;
|
||||
#endif // server only
|
||||
|
||||
#ifndef GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX
|
||||
@ -96,4 +32,3 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -46,27 +46,6 @@
|
||||
#include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
#define GL_DEBUG_SEVERITY_HIGH_ARB GL_DEBUG_SEVERITY_HIGH_KHR
|
||||
#define GL_DEBUG_SEVERITY_LOW_ARB GL_DEBUG_SEVERITY_LOW_KHR
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM_ARB GL_DEBUG_SEVERITY_MEDIUM_KHR
|
||||
#define GL_DEBUG_SOURCE_API_ARB GL_DEBUG_SOURCE_API_KHR
|
||||
#define GL_DEBUG_SOURCE_APPLICATION_ARB GL_DEBUG_SOURCE_APPLICATION_KHR
|
||||
#define GL_DEBUG_SOURCE_OTHER_ARB GL_DEBUG_SOURCE_OTHER_KHR
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB GL_DEBUG_SOURCE_SHADER_COMPILER_KHR
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB GL_DEBUG_SOURCE_THIRD_PARTY_KHR
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR
|
||||
#define GL_DEBUG_TYPE_ERROR_ARB GL_DEBUG_TYPE_ERROR_KHR
|
||||
#define GL_DEBUG_TYPE_OTHER_ARB GL_DEBUG_TYPE_OTHER_KHR
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE_ARB GL_DEBUG_TYPE_PERFORMANCE_KHR
|
||||
#define GL_DEBUG_TYPE_PORTABILITY_ARB GL_DEBUG_TYPE_PORTABILITY_KHR
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR
|
||||
|
||||
#define GLDEBUGPROCARB GLDEBUGPROCKHR
|
||||
PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR;
|
||||
#define glDebugMessageCallbackARB pglDebugMessageCallbackKHR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static bool is_gl_init = false;
|
||||
@ -161,12 +140,6 @@ debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei le
|
||||
#endif
|
||||
|
||||
#ifdef USE_GLES2
|
||||
#ifndef IOS_STK
|
||||
GL_APICALL void(*GL_APIENTRY glDebugMessageControl)(GLenum source, GLenum type,
|
||||
GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
GL_APICALL void(*GL_APIENTRY glDebugMessageInsert)(GLenum source, GLenum type,
|
||||
GLuint id, GLenum severity, GLsizei length, const char *message);
|
||||
#endif
|
||||
|
||||
#define GL_DEBUG_SOURCE_APPLICATION 0x824A
|
||||
#define GL_DEBUG_TYPE_MARKER 0x8268
|
||||
@ -177,68 +150,36 @@ void initGL()
|
||||
{
|
||||
if (is_gl_init)
|
||||
return;
|
||||
|
||||
|
||||
is_gl_init = true;
|
||||
// For Mesa extension reporting
|
||||
#if !defined(USE_GLES2)
|
||||
#ifndef WIN32
|
||||
glewExperimental = GL_TRUE;
|
||||
#endif
|
||||
GLenum err = glewInit();
|
||||
|
||||
if (err == GLEW_ERROR_NO_GLX_DISPLAY)
|
||||
{
|
||||
Log::info("GLEW", "Glew couldn't open glx display.");
|
||||
}
|
||||
else if (err != GLEW_OK)
|
||||
{
|
||||
Log::fatal("GLEW", "Glew initialization failed with error %s", glewGetErrorString(err));
|
||||
}
|
||||
#else
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)SDL_GL_GetProcAddress("glDebugMessageCallbackKHR");
|
||||
#endif
|
||||
if (glDebugMessageCallback)
|
||||
glDebugMessageCallback((GLDEBUGPROCARB)debugCallback, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
if (glDebugMessageCallbackARB)
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)debugCallback, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef ANDROID
|
||||
if (SP::sp_apitrace && hasGLExtension("GL_KHR_debug"))
|
||||
{
|
||||
#ifndef IOS_STK
|
||||
#ifdef USE_GLES2
|
||||
glDebugMessageControl = (void(GL_APIENTRY*)(GLenum, GLenum, GLenum, GLsizei,
|
||||
const GLuint*, GLboolean))SDL_GL_GetProcAddress("glDebugMessageControlKHR");
|
||||
glDebugMessageInsert = (void(GL_APIENTRY*)(GLenum, GLenum, GLuint, GLenum,
|
||||
GLsizei, const char*))SDL_GL_GetProcAddress("glDebugMessageInsertKHR");
|
||||
assert(glDebugMessageControl && glDebugMessageInsert);
|
||||
#endif
|
||||
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
|
||||
#endif
|
||||
if (glDebugMessageControl)
|
||||
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SP::sp_apitrace = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ScopedGPUTimer::ScopedGPUTimer(GPUTimer &t) : timer(t)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
#ifndef IOS_STK
|
||||
if (SP::sp_apitrace)
|
||||
{
|
||||
std::string msg = timer.getName();
|
||||
msg += " begin";
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 100,
|
||||
GL_DEBUG_SEVERITY_NOTIFICATION, -1, msg.c_str());
|
||||
if (glDebugMessageInsert)
|
||||
{
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 100,
|
||||
GL_DEBUG_SEVERITY_NOTIFICATION, -1, msg.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (!UserConfigParams::m_profiler_enabled) return;
|
||||
if (profiler.isFrozen()) return;
|
||||
if (!timer.canSubmitQuery) return;
|
||||
@ -253,17 +194,16 @@ ScopedGPUTimer::ScopedGPUTimer(GPUTimer &t) : timer(t)
|
||||
}
|
||||
ScopedGPUTimer::~ScopedGPUTimer()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
#ifndef IOS_STK
|
||||
if (SP::sp_apitrace)
|
||||
{
|
||||
std::string msg = timer.getName();
|
||||
msg += " end";
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 100,
|
||||
GL_DEBUG_SEVERITY_NOTIFICATION, -1, msg.c_str());
|
||||
if (glDebugMessageInsert)
|
||||
{
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 100,
|
||||
GL_DEBUG_SEVERITY_NOTIFICATION, -1, msg.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (!UserConfigParams::m_profiler_enabled) return;
|
||||
if (profiler.isFrozen()) return;
|
||||
if (!timer.canSubmitQuery) return;
|
||||
|
@ -101,10 +101,10 @@ public:
|
||||
sizeof(LightBaseClass::PointLightInfo),
|
||||
(GLvoid*)(7 * sizeof(float)));
|
||||
|
||||
glVertexAttribDivisorARB(attrib_Position, 1);
|
||||
glVertexAttribDivisorARB(attrib_Energy, 1);
|
||||
glVertexAttribDivisorARB(attrib_Color, 1);
|
||||
glVertexAttribDivisorARB(attrib_Radius, 1);
|
||||
glVertexAttribDivisor(attrib_Position, 1);
|
||||
glVertexAttribDivisor(attrib_Energy, 1);
|
||||
glVertexAttribDivisor(attrib_Color, 1);
|
||||
glVertexAttribDivisor(attrib_Radius, 1);
|
||||
} // PointLightShader
|
||||
~PointLightShader()
|
||||
{
|
||||
@ -156,10 +156,10 @@ public:
|
||||
sizeof(LightBaseClass::PointLightInfo),
|
||||
(GLvoid*)(7 * sizeof(float)));
|
||||
|
||||
glVertexAttribDivisorARB(attrib_Position, 1);
|
||||
glVertexAttribDivisorARB(attrib_Energy, 1);
|
||||
glVertexAttribDivisorARB(attrib_Color, 1);
|
||||
glVertexAttribDivisorARB(attrib_Radius, 1);
|
||||
glVertexAttribDivisor(attrib_Position, 1);
|
||||
glVertexAttribDivisor(attrib_Energy, 1);
|
||||
glVertexAttribDivisor(attrib_Color, 1);
|
||||
glVertexAttribDivisor(attrib_Radius, 1);
|
||||
} // PointLightScatterShader
|
||||
~PointLightScatterShader()
|
||||
{
|
||||
|
@ -121,23 +121,23 @@ SPDynamicDrawCall::SPDynamicDrawCall(scene::E_PRIMITIVE_TYPE pt,
|
||||
// Origin
|
||||
glEnableVertexAttribArray(8);
|
||||
glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, 44, (void*)0);
|
||||
glVertexAttribDivisorARB(8, 1);
|
||||
glVertexAttribDivisor(8, 1);
|
||||
// Rotation (quaternion in 4 32bit floats)
|
||||
glEnableVertexAttribArray(9);
|
||||
glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, 44, (void*)12);
|
||||
glVertexAttribDivisorARB(9, 1);
|
||||
glVertexAttribDivisor(9, 1);
|
||||
// Scale (3 half floats and .w unused)
|
||||
glEnableVertexAttribArray(10);
|
||||
glVertexAttribPointer(10, 4, GL_HALF_FLOAT, GL_FALSE, 44, (void*)28);
|
||||
glVertexAttribDivisorARB(10, 1);
|
||||
glVertexAttribDivisor(10, 1);
|
||||
// Texture translation
|
||||
glEnableVertexAttribArray(11);
|
||||
glVertexAttribPointer(11, 2, GL_SHORT, GL_TRUE, 44, (void*)36);
|
||||
glVertexAttribDivisorARB(11, 1);
|
||||
glVertexAttribDivisor(11, 1);
|
||||
// Misc data (skinning offset and hue change)
|
||||
glEnableVertexAttribArray(12);
|
||||
glVertexAttribIPointer(12, 2, GL_SHORT, 44, (void*)40);
|
||||
glVertexAttribDivisorARB(12, 1);
|
||||
glVertexAttribDivisor(12, 1);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
#endif
|
||||
|
@ -349,23 +349,23 @@ void SPMeshBuffer::recreateVAO(unsigned i)
|
||||
// Origin
|
||||
glEnableVertexAttribArray(8);
|
||||
glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, 44, (void*)0);
|
||||
glVertexAttribDivisorARB(8, 1);
|
||||
glVertexAttribDivisor(8, 1);
|
||||
// Rotation (quaternion in 4 32bit floats)
|
||||
glEnableVertexAttribArray(9);
|
||||
glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, 44, (void*)12);
|
||||
glVertexAttribDivisorARB(9, 1);
|
||||
glVertexAttribDivisor(9, 1);
|
||||
// Scale (3 half floats and .w unused)
|
||||
glEnableVertexAttribArray(10);
|
||||
glVertexAttribPointer(10, 4, GL_HALF_FLOAT, GL_FALSE, 44, (void*)28);
|
||||
glVertexAttribDivisorARB(10, 1);
|
||||
glVertexAttribDivisor(10, 1);
|
||||
// Texture translation
|
||||
glEnableVertexAttribArray(11);
|
||||
glVertexAttribPointer(11, 2, GL_SHORT, GL_TRUE, 44, (void*)36);
|
||||
glVertexAttribDivisorARB(11, 1);
|
||||
glVertexAttribDivisor(11, 1);
|
||||
// Misc data (skinning offset and hue change)
|
||||
glEnableVertexAttribArray(12);
|
||||
glVertexAttribIPointer(12, 2, GL_SHORT, 44, (void*)40);
|
||||
glVertexAttribDivisorARB(12, 1);
|
||||
glVertexAttribDivisor(12, 1);
|
||||
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
@ -225,17 +225,17 @@ void STKTextBillboard::init(const core::stringw& text, FontWithFace* face)
|
||||
// Origin
|
||||
glEnableVertexAttribArray(8);
|
||||
glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, 36, (void*)0);
|
||||
glVertexAttribDivisorARB(8, 1);
|
||||
glVertexAttribDivisor(8, 1);
|
||||
|
||||
// Rotation (quaternion in 4 32bit floats)
|
||||
glEnableVertexAttribArray(9);
|
||||
glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, 36, (void*)12);
|
||||
glVertexAttribDivisorARB(9, 1);
|
||||
glVertexAttribDivisor(9, 1);
|
||||
|
||||
// Scale (3 half floats and .w unused)
|
||||
glEnableVertexAttribArray(10);
|
||||
glVertexAttribPointer(10, 4, GL_HALF_FLOAT, GL_FALSE, 36, (void*)28);
|
||||
glVertexAttribDivisorARB(10, 1);
|
||||
glVertexAttribDivisor(10, 1);
|
||||
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user