mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- Backend update from GZDoom.
This is mainly bringing the GLES backend up to date.
This commit is contained in:
parent
61ba58c529
commit
49e0c461c2
42 changed files with 139 additions and 3007 deletions
|
@ -51,12 +51,10 @@ enum ETexMode
|
||||||
TM_OPAQUE, // (r, g, b, 1)
|
TM_OPAQUE, // (r, g, b, 1)
|
||||||
TM_INVERSE, // (1-r, 1-g, 1-b, a)
|
TM_INVERSE, // (1-r, 1-g, 1-b, a)
|
||||||
TM_ALPHATEXTURE, // (1, 1, 1, r)
|
TM_ALPHATEXTURE, // (1, 1, 1, r)
|
||||||
TM_INVERTOPAQUE = 6, // (1-r, 1-g, 1-b, 1)
|
TM_CLAMPY, // (r, g, b, (t >= 0.0 && t <= 1.0)? a:0)
|
||||||
|
TM_INVERTOPAQUE, // (1-r, 1-g, 1-b, 1)
|
||||||
TM_FOGLAYER, // (renders a fog layer in the shape of the active texture)
|
TM_FOGLAYER, // (renders a fog layer in the shape of the active texture)
|
||||||
TM_FIXEDCOLORMAP = TM_FOGLAYER, // repurposes the objectcolor uniforms to render a fixed colormap range. (Same constant because they cannot be used in the same context.
|
TM_FIXEDCOLORMAP = TM_FOGLAYER, // repurposes the objectcolor uniforms to render a fixed colormap range. (Same constant because they cannot be used in the same context.
|
||||||
|
|
||||||
TM_CLAMPY = 0x1000, // (r, g, b, (t >= 0.0 && t <= 1.0)? a:0)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Legacy render styles
|
// Legacy render styles
|
||||||
|
|
|
@ -46,6 +46,8 @@ TArray<FString> I_GetSteamPath();
|
||||||
|
|
||||||
TArray<FString> I_GetGogPaths();
|
TArray<FString> I_GetGogPaths();
|
||||||
|
|
||||||
|
TArray<FString> I_GetBethesdaPath();
|
||||||
|
|
||||||
// The ini could not be saved at exit
|
// The ini could not be saved at exit
|
||||||
bool I_WriteIniFailed ();
|
bool I_WriteIniFailed ();
|
||||||
|
|
||||||
|
|
|
@ -50,3 +50,9 @@ TArray<FString> I_GetGogPaths()
|
||||||
// GOG's Doom games are Windows only at the moment
|
// GOG's Doom games are Windows only at the moment
|
||||||
return TArray<FString>();
|
return TArray<FString>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TArray<FString> I_GetBethesdaPath()
|
||||||
|
{
|
||||||
|
// Bethesda.net Launcher is Windows only at the moment
|
||||||
|
return TArray<FString>();
|
||||||
|
}
|
||||||
|
|
|
@ -150,6 +150,8 @@ namespace Priv
|
||||||
{
|
{
|
||||||
// Enforce minimum size limit
|
// Enforce minimum size limit
|
||||||
SDL_SetWindowMinimumSize(Priv::window, VID_MIN_WIDTH, VID_MIN_HEIGHT);
|
SDL_SetWindowMinimumSize(Priv::window, VID_MIN_WIDTH, VID_MIN_HEIGHT);
|
||||||
|
// Tell SDL to start sending text input on Wayland.
|
||||||
|
if (strncasecmp(SDL_GetCurrentVideoDriver(), "wayland", 7) == 0) SDL_StartTextInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@ TArray<FString> I_GetSteamPath();
|
||||||
// [GZ] Same deal for GOG paths
|
// [GZ] Same deal for GOG paths
|
||||||
TArray<FString> I_GetGogPaths();
|
TArray<FString> I_GetGogPaths();
|
||||||
|
|
||||||
|
// Again for the Bethesda.net Launcher path
|
||||||
|
TArray<FString> I_GetBethesdaPath();
|
||||||
|
|
||||||
// Damn Microsoft for doing Get/SetWindowLongPtr half-assed. Instead of
|
// Damn Microsoft for doing Get/SetWindowLongPtr half-assed. Instead of
|
||||||
// giving them proper prototypes under Win32, they are just macros for
|
// giving them proper prototypes under Win32, they are just macros for
|
||||||
// Get/SetWindowLong, meaning they take LONGs and not LONG_PTRs.
|
// Get/SetWindowLong, meaning they take LONGs and not LONG_PTRs.
|
||||||
|
|
|
@ -124,9 +124,7 @@ bool FGLRenderState::ApplyShader()
|
||||||
activeShader->muDesaturation.Set(mStreamData.uDesaturationFactor);
|
activeShader->muDesaturation.Set(mStreamData.uDesaturationFactor);
|
||||||
activeShader->muFogEnabled.Set(fogset);
|
activeShader->muFogEnabled.Set(fogset);
|
||||||
|
|
||||||
int f = mTextureModeFlags;
|
activeShader->muTextureMode.Set(GetTextureModeAndFlags(mTempTM));
|
||||||
if (!mBrightmapEnabled) f &= ~(TEXF_Brightmap | TEXF_Glowmap);
|
|
||||||
activeShader->muTextureMode.Set((mTextureMode == TM_NORMAL && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode) | f);
|
|
||||||
activeShader->muLightParms.Set(mLightParms);
|
activeShader->muLightParms.Set(mLightParms);
|
||||||
activeShader->muFogColor.Set(mStreamData.uFogColor);
|
activeShader->muFogColor.Set(mStreamData.uFogColor);
|
||||||
activeShader->muObjectColor.Set(mStreamData.uObjectColor);
|
activeShader->muObjectColor.Set(mStreamData.uObjectColor);
|
||||||
|
|
|
@ -1,303 +0,0 @@
|
||||||
#ifndef __egl_h_
|
|
||||||
#define __egl_h_ 1
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Copyright (c) 2013-2014 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.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
|
||||||
** API Registry. The current version of the Registry, generator scripts
|
|
||||||
** used to make the header, and the header can be found at
|
|
||||||
** http://www.opengl.org/registry/
|
|
||||||
**
|
|
||||||
** Khronos $Revision: 29318 $ on $Date: 2015-01-02 03:16:10 -0800 (Fri, 02 Jan 2015) $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <EGL/eglplatform.h>
|
|
||||||
|
|
||||||
/* Generated on date 20150102 */
|
|
||||||
|
|
||||||
/* Generated C header for:
|
|
||||||
* API: egl
|
|
||||||
* Versions considered: .*
|
|
||||||
* Versions emitted: .*
|
|
||||||
* Default extensions included: None
|
|
||||||
* Additional extensions included: _nomatch_^
|
|
||||||
* Extensions removed: _nomatch_^
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EGL_VERSION_1_0
|
|
||||||
#define EGL_VERSION_1_0 1
|
|
||||||
typedef unsigned int EGLBoolean;
|
|
||||||
typedef void *EGLDisplay;
|
|
||||||
#include <KHR/khrplatform.h>
|
|
||||||
#include <EGL/eglplatform.h>
|
|
||||||
typedef void *EGLConfig;
|
|
||||||
typedef void *EGLSurface;
|
|
||||||
typedef void *EGLContext;
|
|
||||||
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
|
||||||
#define EGL_ALPHA_SIZE 0x3021
|
|
||||||
#define EGL_BAD_ACCESS 0x3002
|
|
||||||
#define EGL_BAD_ALLOC 0x3003
|
|
||||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
|
||||||
#define EGL_BAD_CONFIG 0x3005
|
|
||||||
#define EGL_BAD_CONTEXT 0x3006
|
|
||||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
|
||||||
#define EGL_BAD_DISPLAY 0x3008
|
|
||||||
#define EGL_BAD_MATCH 0x3009
|
|
||||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
|
||||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
|
||||||
#define EGL_BAD_PARAMETER 0x300C
|
|
||||||
#define EGL_BAD_SURFACE 0x300D
|
|
||||||
#define EGL_BLUE_SIZE 0x3022
|
|
||||||
#define EGL_BUFFER_SIZE 0x3020
|
|
||||||
#define EGL_CONFIG_CAVEAT 0x3027
|
|
||||||
#define EGL_CONFIG_ID 0x3028
|
|
||||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
|
||||||
#define EGL_DEPTH_SIZE 0x3025
|
|
||||||
#define EGL_DONT_CARE ((EGLint)-1)
|
|
||||||
#define EGL_DRAW 0x3059
|
|
||||||
#define EGL_EXTENSIONS 0x3055
|
|
||||||
#define EGL_FALSE 0
|
|
||||||
#define EGL_GREEN_SIZE 0x3023
|
|
||||||
#define EGL_HEIGHT 0x3056
|
|
||||||
#define EGL_LARGEST_PBUFFER 0x3058
|
|
||||||
#define EGL_LEVEL 0x3029
|
|
||||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
|
||||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
|
||||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
|
||||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
|
||||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
|
||||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
|
||||||
#define EGL_NONE 0x3038
|
|
||||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051
|
|
||||||
#define EGL_NOT_INITIALIZED 0x3001
|
|
||||||
#define EGL_NO_CONTEXT ((EGLContext)0)
|
|
||||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
|
||||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
|
||||||
#define EGL_PBUFFER_BIT 0x0001
|
|
||||||
#define EGL_PIXMAP_BIT 0x0002
|
|
||||||
#define EGL_READ 0x305A
|
|
||||||
#define EGL_RED_SIZE 0x3024
|
|
||||||
#define EGL_SAMPLES 0x3031
|
|
||||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
|
||||||
#define EGL_SLOW_CONFIG 0x3050
|
|
||||||
#define EGL_STENCIL_SIZE 0x3026
|
|
||||||
#define EGL_SUCCESS 0x3000
|
|
||||||
#define EGL_SURFACE_TYPE 0x3033
|
|
||||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
|
||||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
|
||||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
|
||||||
#define EGL_TRANSPARENT_RGB 0x3052
|
|
||||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
|
||||||
#define EGL_TRUE 1
|
|
||||||
#define EGL_VENDOR 0x3053
|
|
||||||
#define EGL_VERSION 0x3054
|
|
||||||
#define EGL_WIDTH 0x3057
|
|
||||||
#define EGL_WINDOW_BIT 0x0004
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
|
|
||||||
EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
|
||||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
|
|
||||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
|
|
||||||
EGLAPI EGLint EGLAPIENTRY eglGetError (void);
|
|
||||||
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
|
|
||||||
EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
|
|
||||||
#endif /* EGL_VERSION_1_0 */
|
|
||||||
|
|
||||||
#ifndef EGL_VERSION_1_1
|
|
||||||
#define EGL_VERSION_1_1 1
|
|
||||||
#define EGL_BACK_BUFFER 0x3084
|
|
||||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
|
||||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
|
||||||
#define EGL_CONTEXT_LOST 0x300E
|
|
||||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
|
||||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
|
||||||
#define EGL_MIPMAP_TEXTURE 0x3082
|
|
||||||
#define EGL_MIPMAP_LEVEL 0x3083
|
|
||||||
#define EGL_NO_TEXTURE 0x305C
|
|
||||||
#define EGL_TEXTURE_2D 0x305F
|
|
||||||
#define EGL_TEXTURE_FORMAT 0x3080
|
|
||||||
#define EGL_TEXTURE_RGB 0x305D
|
|
||||||
#define EGL_TEXTURE_RGBA 0x305E
|
|
||||||
#define EGL_TEXTURE_TARGET 0x3081
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
|
|
||||||
#endif /* EGL_VERSION_1_1 */
|
|
||||||
|
|
||||||
#ifndef EGL_VERSION_1_2
|
|
||||||
#define EGL_VERSION_1_2 1
|
|
||||||
typedef unsigned int EGLenum;
|
|
||||||
typedef void *EGLClientBuffer;
|
|
||||||
#define EGL_ALPHA_FORMAT 0x3088
|
|
||||||
#define EGL_ALPHA_FORMAT_NONPRE 0x308B
|
|
||||||
#define EGL_ALPHA_FORMAT_PRE 0x308C
|
|
||||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
|
||||||
#define EGL_BUFFER_PRESERVED 0x3094
|
|
||||||
#define EGL_BUFFER_DESTROYED 0x3095
|
|
||||||
#define EGL_CLIENT_APIS 0x308D
|
|
||||||
#define EGL_COLORSPACE 0x3087
|
|
||||||
#define EGL_COLORSPACE_sRGB 0x3089
|
|
||||||
#define EGL_COLORSPACE_LINEAR 0x308A
|
|
||||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
|
||||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
|
||||||
#define EGL_DISPLAY_SCALING 10000
|
|
||||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
|
||||||
#define EGL_LUMINANCE_BUFFER 0x308F
|
|
||||||
#define EGL_LUMINANCE_SIZE 0x303D
|
|
||||||
#define EGL_OPENGL_ES_BIT 0x0001
|
|
||||||
#define EGL_OPENVG_BIT 0x0002
|
|
||||||
#define EGL_OPENGL_ES_API 0x30A0
|
|
||||||
#define EGL_OPENVG_API 0x30A1
|
|
||||||
#define EGL_OPENVG_IMAGE 0x3096
|
|
||||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
|
||||||
#define EGL_RENDERABLE_TYPE 0x3040
|
|
||||||
#define EGL_RENDER_BUFFER 0x3086
|
|
||||||
#define EGL_RGB_BUFFER 0x308E
|
|
||||||
#define EGL_SINGLE_BUFFER 0x3085
|
|
||||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
|
||||||
#define EGL_UNKNOWN ((EGLint)-1)
|
|
||||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
|
|
||||||
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
|
|
||||||
#endif /* EGL_VERSION_1_2 */
|
|
||||||
|
|
||||||
#ifndef EGL_VERSION_1_3
|
|
||||||
#define EGL_VERSION_1_3 1
|
|
||||||
#define EGL_CONFORMANT 0x3042
|
|
||||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
|
||||||
#define EGL_MATCH_NATIVE_PIXMAP 0x3041
|
|
||||||
#define EGL_OPENGL_ES2_BIT 0x0004
|
|
||||||
#define EGL_VG_ALPHA_FORMAT 0x3088
|
|
||||||
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
|
|
||||||
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
|
|
||||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
|
|
||||||
#define EGL_VG_COLORSPACE 0x3087
|
|
||||||
#define EGL_VG_COLORSPACE_sRGB 0x3089
|
|
||||||
#define EGL_VG_COLORSPACE_LINEAR 0x308A
|
|
||||||
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
|
|
||||||
#endif /* EGL_VERSION_1_3 */
|
|
||||||
|
|
||||||
#ifndef EGL_VERSION_1_4
|
|
||||||
#define EGL_VERSION_1_4 1
|
|
||||||
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
|
|
||||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
|
|
||||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
|
||||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
|
|
||||||
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
|
|
||||||
#define EGL_OPENGL_API 0x30A2
|
|
||||||
#define EGL_OPENGL_BIT 0x0008
|
|
||||||
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
|
|
||||||
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
|
|
||||||
#endif /* EGL_VERSION_1_4 */
|
|
||||||
|
|
||||||
#ifndef EGL_VERSION_1_5
|
|
||||||
#define EGL_VERSION_1_5 1
|
|
||||||
typedef void *EGLSync;
|
|
||||||
typedef intptr_t EGLAttrib;
|
|
||||||
typedef khronos_utime_nanoseconds_t EGLTime;
|
|
||||||
typedef void *EGLImage;
|
|
||||||
#define EGL_CONTEXT_MAJOR_VERSION 0x3098
|
|
||||||
#define EGL_CONTEXT_MINOR_VERSION 0x30FB
|
|
||||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
|
|
||||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
|
|
||||||
#define EGL_NO_RESET_NOTIFICATION 0x31BE
|
|
||||||
#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
|
|
||||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
|
|
||||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
|
|
||||||
#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
|
|
||||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
|
|
||||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
|
|
||||||
#define EGL_OPENGL_ES3_BIT 0x00000040
|
|
||||||
#define EGL_CL_EVENT_HANDLE 0x309C
|
|
||||||
#define EGL_SYNC_CL_EVENT 0x30FE
|
|
||||||
#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
|
|
||||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
|
|
||||||
#define EGL_SYNC_TYPE 0x30F7
|
|
||||||
#define EGL_SYNC_STATUS 0x30F1
|
|
||||||
#define EGL_SYNC_CONDITION 0x30F8
|
|
||||||
#define EGL_SIGNALED 0x30F2
|
|
||||||
#define EGL_UNSIGNALED 0x30F3
|
|
||||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
|
|
||||||
#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
|
|
||||||
#define EGL_TIMEOUT_EXPIRED 0x30F5
|
|
||||||
#define EGL_CONDITION_SATISFIED 0x30F6
|
|
||||||
#define EGL_NO_SYNC ((EGLSync)0)
|
|
||||||
#define EGL_SYNC_FENCE 0x30F9
|
|
||||||
#define EGL_GL_COLORSPACE 0x309D
|
|
||||||
#define EGL_GL_COLORSPACE_SRGB 0x3089
|
|
||||||
#define EGL_GL_COLORSPACE_LINEAR 0x308A
|
|
||||||
#define EGL_GL_RENDERBUFFER 0x30B9
|
|
||||||
#define EGL_GL_TEXTURE_2D 0x30B1
|
|
||||||
#define EGL_GL_TEXTURE_LEVEL 0x30BC
|
|
||||||
#define EGL_GL_TEXTURE_3D 0x30B2
|
|
||||||
#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
|
|
||||||
#define EGL_IMAGE_PRESERVED 0x30D2
|
|
||||||
#define EGL_NO_IMAGE ((EGLImage)0)
|
|
||||||
EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
|
|
||||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
|
|
||||||
EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
|
|
||||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
|
|
||||||
#endif /* EGL_VERSION_1_5 */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,826 +0,0 @@
|
||||||
#ifndef __eglext_h_
|
|
||||||
#define __eglext_h_ 1
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Copyright (c) 2013-2014 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.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
|
||||||
** API Registry. The current version of the Registry, generator scripts
|
|
||||||
** used to make the header, and the header can be found at
|
|
||||||
** http://www.opengl.org/registry/
|
|
||||||
**
|
|
||||||
** Khronos $Revision: 29318 $ on $Date: 2015-01-02 03:16:10 -0800 (Fri, 02 Jan 2015) $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <EGL/eglplatform.h>
|
|
||||||
|
|
||||||
#define EGL_EGLEXT_VERSION 20150102
|
|
||||||
|
|
||||||
/* Generated C header for:
|
|
||||||
* API: egl
|
|
||||||
* Versions considered: .*
|
|
||||||
* Versions emitted: _nomatch_^
|
|
||||||
* Default extensions included: egl
|
|
||||||
* Additional extensions included: _nomatch_^
|
|
||||||
* Extensions removed: _nomatch_^
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_cl_event
|
|
||||||
#define EGL_KHR_cl_event 1
|
|
||||||
#define EGL_CL_EVENT_HANDLE_KHR 0x309C
|
|
||||||
#define EGL_SYNC_CL_EVENT_KHR 0x30FE
|
|
||||||
#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
|
|
||||||
#endif /* EGL_KHR_cl_event */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_cl_event2
|
|
||||||
#define EGL_KHR_cl_event2 1
|
|
||||||
typedef void *EGLSyncKHR;
|
|
||||||
typedef intptr_t EGLAttribKHR;
|
|
||||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_cl_event2 */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_client_get_all_proc_addresses
|
|
||||||
#define EGL_KHR_client_get_all_proc_addresses 1
|
|
||||||
#endif /* EGL_KHR_client_get_all_proc_addresses */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_config_attribs
|
|
||||||
#define EGL_KHR_config_attribs 1
|
|
||||||
#define EGL_CONFORMANT_KHR 0x3042
|
|
||||||
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
|
|
||||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
|
|
||||||
#endif /* EGL_KHR_config_attribs */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_create_context
|
|
||||||
#define EGL_KHR_create_context 1
|
|
||||||
#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
|
|
||||||
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
|
|
||||||
#define EGL_CONTEXT_FLAGS_KHR 0x30FC
|
|
||||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
|
|
||||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
|
|
||||||
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
|
|
||||||
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
|
|
||||||
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
|
|
||||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
|
|
||||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
|
|
||||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
|
|
||||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
|
|
||||||
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
|
|
||||||
#endif /* EGL_KHR_create_context */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_fence_sync
|
|
||||||
#define EGL_KHR_fence_sync 1
|
|
||||||
#ifdef KHRONOS_SUPPORT_INT64
|
|
||||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
|
||||||
#define EGL_SYNC_CONDITION_KHR 0x30F8
|
|
||||||
#define EGL_SYNC_FENCE_KHR 0x30F9
|
|
||||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
|
||||||
#endif /* EGL_KHR_fence_sync */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_get_all_proc_addresses
|
|
||||||
#define EGL_KHR_get_all_proc_addresses 1
|
|
||||||
#endif /* EGL_KHR_get_all_proc_addresses */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_gl_colorspace
|
|
||||||
#define EGL_KHR_gl_colorspace 1
|
|
||||||
#define EGL_GL_COLORSPACE_KHR 0x309D
|
|
||||||
#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
|
|
||||||
#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
|
|
||||||
#endif /* EGL_KHR_gl_colorspace */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_gl_renderbuffer_image
|
|
||||||
#define EGL_KHR_gl_renderbuffer_image 1
|
|
||||||
#define EGL_GL_RENDERBUFFER_KHR 0x30B9
|
|
||||||
#endif /* EGL_KHR_gl_renderbuffer_image */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_gl_texture_2D_image
|
|
||||||
#define EGL_KHR_gl_texture_2D_image 1
|
|
||||||
#define EGL_GL_TEXTURE_2D_KHR 0x30B1
|
|
||||||
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
|
|
||||||
#endif /* EGL_KHR_gl_texture_2D_image */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_gl_texture_3D_image
|
|
||||||
#define EGL_KHR_gl_texture_3D_image 1
|
|
||||||
#define EGL_GL_TEXTURE_3D_KHR 0x30B2
|
|
||||||
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
|
|
||||||
#endif /* EGL_KHR_gl_texture_3D_image */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_gl_texture_cubemap_image
|
|
||||||
#define EGL_KHR_gl_texture_cubemap_image 1
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
|
|
||||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
|
|
||||||
#endif /* EGL_KHR_gl_texture_cubemap_image */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_image
|
|
||||||
#define EGL_KHR_image 1
|
|
||||||
typedef void *EGLImageKHR;
|
|
||||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0
|
|
||||||
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
|
|
||||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_image */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_image_base
|
|
||||||
#define EGL_KHR_image_base 1
|
|
||||||
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
|
|
||||||
#endif /* EGL_KHR_image_base */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_image_pixmap
|
|
||||||
#define EGL_KHR_image_pixmap 1
|
|
||||||
#endif /* EGL_KHR_image_pixmap */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_lock_surface
|
|
||||||
#define EGL_KHR_lock_surface 1
|
|
||||||
#define EGL_READ_SURFACE_BIT_KHR 0x0001
|
|
||||||
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
|
|
||||||
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
|
|
||||||
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
|
|
||||||
#define EGL_MATCH_FORMAT_KHR 0x3043
|
|
||||||
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
|
|
||||||
#define EGL_FORMAT_RGB_565_KHR 0x30C1
|
|
||||||
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
|
|
||||||
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
|
|
||||||
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
|
|
||||||
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
|
|
||||||
#define EGL_BITMAP_POINTER_KHR 0x30C6
|
|
||||||
#define EGL_BITMAP_PITCH_KHR 0x30C7
|
|
||||||
#define EGL_BITMAP_ORIGIN_KHR 0x30C8
|
|
||||||
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
|
|
||||||
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
|
|
||||||
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
|
|
||||||
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
|
|
||||||
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
|
|
||||||
#define EGL_LOWER_LEFT_KHR 0x30CE
|
|
||||||
#define EGL_UPPER_LEFT_KHR 0x30CF
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_lock_surface */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_lock_surface2
|
|
||||||
#define EGL_KHR_lock_surface2 1
|
|
||||||
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
|
|
||||||
#endif /* EGL_KHR_lock_surface2 */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_lock_surface3
|
|
||||||
#define EGL_KHR_lock_surface3 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_lock_surface3 */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_partial_update
|
|
||||||
#define EGL_KHR_partial_update 1
|
|
||||||
#define EGL_BUFFER_AGE_KHR 0x313D
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_partial_update */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_platform_android
|
|
||||||
#define EGL_KHR_platform_android 1
|
|
||||||
#define EGL_PLATFORM_ANDROID_KHR 0x3141
|
|
||||||
#endif /* EGL_KHR_platform_android */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_platform_gbm
|
|
||||||
#define EGL_KHR_platform_gbm 1
|
|
||||||
#define EGL_PLATFORM_GBM_KHR 0x31D7
|
|
||||||
#endif /* EGL_KHR_platform_gbm */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_platform_wayland
|
|
||||||
#define EGL_KHR_platform_wayland 1
|
|
||||||
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
|
|
||||||
#endif /* EGL_KHR_platform_wayland */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_platform_x11
|
|
||||||
#define EGL_KHR_platform_x11 1
|
|
||||||
#define EGL_PLATFORM_X11_KHR 0x31D5
|
|
||||||
#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
|
|
||||||
#endif /* EGL_KHR_platform_x11 */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_reusable_sync
|
|
||||||
#define EGL_KHR_reusable_sync 1
|
|
||||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
|
||||||
#ifdef KHRONOS_SUPPORT_INT64
|
|
||||||
#define EGL_SYNC_STATUS_KHR 0x30F1
|
|
||||||
#define EGL_SIGNALED_KHR 0x30F2
|
|
||||||
#define EGL_UNSIGNALED_KHR 0x30F3
|
|
||||||
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
|
|
||||||
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
|
|
||||||
#define EGL_SYNC_TYPE_KHR 0x30F7
|
|
||||||
#define EGL_SYNC_REUSABLE_KHR 0x30FA
|
|
||||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
|
|
||||||
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
|
||||||
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
|
||||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
|
||||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
|
|
||||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
|
||||||
#endif
|
|
||||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
|
||||||
#endif /* EGL_KHR_reusable_sync */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_stream
|
|
||||||
#define EGL_KHR_stream 1
|
|
||||||
typedef void *EGLStreamKHR;
|
|
||||||
typedef khronos_uint64_t EGLuint64KHR;
|
|
||||||
#ifdef KHRONOS_SUPPORT_INT64
|
|
||||||
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
|
|
||||||
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
|
|
||||||
#define EGL_PRODUCER_FRAME_KHR 0x3212
|
|
||||||
#define EGL_CONSUMER_FRAME_KHR 0x3213
|
|
||||||
#define EGL_STREAM_STATE_KHR 0x3214
|
|
||||||
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
|
|
||||||
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
|
|
||||||
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
|
|
||||||
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
|
|
||||||
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
|
|
||||||
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
|
|
||||||
#define EGL_BAD_STREAM_KHR 0x321B
|
|
||||||
#define EGL_BAD_STATE_KHR 0x321C
|
|
||||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
|
||||||
#endif
|
|
||||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
|
||||||
#endif /* EGL_KHR_stream */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_stream_consumer_gltexture
|
|
||||||
#define EGL_KHR_stream_consumer_gltexture 1
|
|
||||||
#ifdef EGL_KHR_stream
|
|
||||||
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_stream */
|
|
||||||
#endif /* EGL_KHR_stream_consumer_gltexture */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_stream_cross_process_fd
|
|
||||||
#define EGL_KHR_stream_cross_process_fd 1
|
|
||||||
typedef int EGLNativeFileDescriptorKHR;
|
|
||||||
#ifdef EGL_KHR_stream
|
|
||||||
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
|
|
||||||
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
|
||||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_stream */
|
|
||||||
#endif /* EGL_KHR_stream_cross_process_fd */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_stream_fifo
|
|
||||||
#define EGL_KHR_stream_fifo 1
|
|
||||||
#ifdef EGL_KHR_stream
|
|
||||||
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
|
|
||||||
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
|
|
||||||
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
|
|
||||||
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_stream */
|
|
||||||
#endif /* EGL_KHR_stream_fifo */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_stream_producer_aldatalocator
|
|
||||||
#define EGL_KHR_stream_producer_aldatalocator 1
|
|
||||||
#ifdef EGL_KHR_stream
|
|
||||||
#endif /* EGL_KHR_stream */
|
|
||||||
#endif /* EGL_KHR_stream_producer_aldatalocator */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_stream_producer_eglsurface
|
|
||||||
#define EGL_KHR_stream_producer_eglsurface 1
|
|
||||||
#ifdef EGL_KHR_stream
|
|
||||||
#define EGL_STREAM_BIT_KHR 0x0800
|
|
||||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_stream */
|
|
||||||
#endif /* EGL_KHR_stream_producer_eglsurface */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_surfaceless_context
|
|
||||||
#define EGL_KHR_surfaceless_context 1
|
|
||||||
#endif /* EGL_KHR_surfaceless_context */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_swap_buffers_with_damage
|
|
||||||
#define EGL_KHR_swap_buffers_with_damage 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_swap_buffers_with_damage */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_vg_parent_image
|
|
||||||
#define EGL_KHR_vg_parent_image 1
|
|
||||||
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
|
|
||||||
#endif /* EGL_KHR_vg_parent_image */
|
|
||||||
|
|
||||||
#ifndef EGL_KHR_wait_sync
|
|
||||||
#define EGL_KHR_wait_sync 1
|
|
||||||
typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_KHR_wait_sync */
|
|
||||||
|
|
||||||
#ifndef EGL_ANDROID_blob_cache
|
|
||||||
#define EGL_ANDROID_blob_cache 1
|
|
||||||
typedef khronos_ssize_t EGLsizeiANDROID;
|
|
||||||
typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
|
|
||||||
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
|
|
||||||
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_ANDROID_blob_cache */
|
|
||||||
|
|
||||||
#ifndef EGL_ANDROID_framebuffer_target
|
|
||||||
#define EGL_ANDROID_framebuffer_target 1
|
|
||||||
#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
|
|
||||||
#endif /* EGL_ANDROID_framebuffer_target */
|
|
||||||
|
|
||||||
#ifndef EGL_ANDROID_image_native_buffer
|
|
||||||
#define EGL_ANDROID_image_native_buffer 1
|
|
||||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140
|
|
||||||
#endif /* EGL_ANDROID_image_native_buffer */
|
|
||||||
|
|
||||||
#ifndef EGL_ANDROID_native_fence_sync
|
|
||||||
#define EGL_ANDROID_native_fence_sync 1
|
|
||||||
#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
|
|
||||||
#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
|
|
||||||
#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
|
|
||||||
#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
|
|
||||||
typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_ANDROID_native_fence_sync */
|
|
||||||
|
|
||||||
#ifndef EGL_ANDROID_recordable
|
|
||||||
#define EGL_ANDROID_recordable 1
|
|
||||||
#define EGL_RECORDABLE_ANDROID 0x3142
|
|
||||||
#endif /* EGL_ANDROID_recordable */
|
|
||||||
|
|
||||||
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
|
|
||||||
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
|
|
||||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
|
||||||
#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
|
|
||||||
|
|
||||||
#ifndef EGL_ANGLE_query_surface_pointer
|
|
||||||
#define EGL_ANGLE_query_surface_pointer 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_ANGLE_query_surface_pointer */
|
|
||||||
|
|
||||||
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
|
||||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
|
|
||||||
#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
|
|
||||||
|
|
||||||
#ifndef EGL_ANGLE_window_fixed_size
|
|
||||||
#define EGL_ANGLE_window_fixed_size 1
|
|
||||||
#define EGL_FIXED_SIZE_ANGLE 0x3201
|
|
||||||
#endif /* EGL_ANGLE_window_fixed_size */
|
|
||||||
|
|
||||||
#ifndef EGL_ARM_pixmap_multisample_discard
|
|
||||||
#define EGL_ARM_pixmap_multisample_discard 1
|
|
||||||
#define EGL_DISCARD_SAMPLES_ARM 0x3286
|
|
||||||
#endif /* EGL_ARM_pixmap_multisample_discard */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_buffer_age
|
|
||||||
#define EGL_EXT_buffer_age 1
|
|
||||||
#define EGL_BUFFER_AGE_EXT 0x313D
|
|
||||||
#endif /* EGL_EXT_buffer_age */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_client_extensions
|
|
||||||
#define EGL_EXT_client_extensions 1
|
|
||||||
#endif /* EGL_EXT_client_extensions */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_create_context_robustness
|
|
||||||
#define EGL_EXT_create_context_robustness 1
|
|
||||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
|
|
||||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
|
|
||||||
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
|
|
||||||
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
|
|
||||||
#endif /* EGL_EXT_create_context_robustness */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_device_base
|
|
||||||
#define EGL_EXT_device_base 1
|
|
||||||
typedef void *EGLDeviceEXT;
|
|
||||||
#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
|
|
||||||
#define EGL_BAD_DEVICE_EXT 0x322B
|
|
||||||
#define EGL_DEVICE_EXT 0x322C
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
|
|
||||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
|
|
||||||
EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_EXT_device_base */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_device_drm
|
|
||||||
#define EGL_EXT_device_drm 1
|
|
||||||
#define EGL_DRM_DEVICE_FILE_EXT 0x3233
|
|
||||||
#endif /* EGL_EXT_device_drm */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_device_openwf
|
|
||||||
#define EGL_EXT_device_openwf 1
|
|
||||||
#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
|
|
||||||
#endif /* EGL_EXT_device_openwf */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_image_dma_buf_import
|
|
||||||
#define EGL_EXT_image_dma_buf_import 1
|
|
||||||
#define EGL_LINUX_DMA_BUF_EXT 0x3270
|
|
||||||
#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
|
|
||||||
#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
|
|
||||||
#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
|
|
||||||
#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
|
|
||||||
#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
|
|
||||||
#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
|
|
||||||
#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
|
|
||||||
#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
|
|
||||||
#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
|
|
||||||
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
|
|
||||||
#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
|
|
||||||
#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
|
|
||||||
#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
|
|
||||||
#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
|
|
||||||
#define EGL_ITU_REC601_EXT 0x327F
|
|
||||||
#define EGL_ITU_REC709_EXT 0x3280
|
|
||||||
#define EGL_ITU_REC2020_EXT 0x3281
|
|
||||||
#define EGL_YUV_FULL_RANGE_EXT 0x3282
|
|
||||||
#define EGL_YUV_NARROW_RANGE_EXT 0x3283
|
|
||||||
#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
|
|
||||||
#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
|
|
||||||
#endif /* EGL_EXT_image_dma_buf_import */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_multiview_window
|
|
||||||
#define EGL_EXT_multiview_window 1
|
|
||||||
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
|
|
||||||
#endif /* EGL_EXT_multiview_window */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_output_base
|
|
||||||
#define EGL_EXT_output_base 1
|
|
||||||
typedef void *EGLOutputLayerEXT;
|
|
||||||
typedef void *EGLOutputPortEXT;
|
|
||||||
#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
|
|
||||||
#define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0)
|
|
||||||
#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
|
|
||||||
#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
|
|
||||||
#define EGL_SWAP_INTERVAL_EXT 0x322F
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
|
|
||||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
|
|
||||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
|
|
||||||
EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
|
|
||||||
EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_EXT_output_base */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_output_drm
|
|
||||||
#define EGL_EXT_output_drm 1
|
|
||||||
#define EGL_DRM_CRTC_EXT 0x3234
|
|
||||||
#define EGL_DRM_PLANE_EXT 0x3235
|
|
||||||
#define EGL_DRM_CONNECTOR_EXT 0x3236
|
|
||||||
#endif /* EGL_EXT_output_drm */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_output_openwf
|
|
||||||
#define EGL_EXT_output_openwf 1
|
|
||||||
#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
|
|
||||||
#define EGL_OPENWF_PORT_ID_EXT 0x3239
|
|
||||||
#endif /* EGL_EXT_output_openwf */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_platform_base
|
|
||||||
#define EGL_EXT_platform_base 1
|
|
||||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
|
||||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
|
|
||||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_EXT_platform_base */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_platform_device
|
|
||||||
#define EGL_EXT_platform_device 1
|
|
||||||
#define EGL_PLATFORM_DEVICE_EXT 0x313F
|
|
||||||
#endif /* EGL_EXT_platform_device */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_platform_wayland
|
|
||||||
#define EGL_EXT_platform_wayland 1
|
|
||||||
#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
|
|
||||||
#endif /* EGL_EXT_platform_wayland */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_platform_x11
|
|
||||||
#define EGL_EXT_platform_x11 1
|
|
||||||
#define EGL_PLATFORM_X11_EXT 0x31D5
|
|
||||||
#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
|
|
||||||
#endif /* EGL_EXT_platform_x11 */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_protected_surface
|
|
||||||
#define EGL_EXT_protected_surface 1
|
|
||||||
#define EGL_PROTECTED_CONTENT_EXT 0x32C0
|
|
||||||
#endif /* EGL_EXT_protected_surface */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_stream_consumer_egloutput
|
|
||||||
#define EGL_EXT_stream_consumer_egloutput 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_EXT_stream_consumer_egloutput */
|
|
||||||
|
|
||||||
#ifndef EGL_EXT_swap_buffers_with_damage
|
|
||||||
#define EGL_EXT_swap_buffers_with_damage 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_EXT_swap_buffers_with_damage */
|
|
||||||
|
|
||||||
#ifndef EGL_HI_clientpixmap
|
|
||||||
#define EGL_HI_clientpixmap 1
|
|
||||||
struct EGLClientPixmapHI {
|
|
||||||
void *pData;
|
|
||||||
EGLint iWidth;
|
|
||||||
EGLint iHeight;
|
|
||||||
EGLint iStride;
|
|
||||||
};
|
|
||||||
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
|
|
||||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_HI_clientpixmap */
|
|
||||||
|
|
||||||
#ifndef EGL_HI_colorformats
|
|
||||||
#define EGL_HI_colorformats 1
|
|
||||||
#define EGL_COLOR_FORMAT_HI 0x8F70
|
|
||||||
#define EGL_COLOR_RGB_HI 0x8F71
|
|
||||||
#define EGL_COLOR_RGBA_HI 0x8F72
|
|
||||||
#define EGL_COLOR_ARGB_HI 0x8F73
|
|
||||||
#endif /* EGL_HI_colorformats */
|
|
||||||
|
|
||||||
#ifndef EGL_IMG_context_priority
|
|
||||||
#define EGL_IMG_context_priority 1
|
|
||||||
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
|
|
||||||
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
|
|
||||||
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
|
|
||||||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
|
||||||
#endif /* EGL_IMG_context_priority */
|
|
||||||
|
|
||||||
#ifndef EGL_MESA_drm_image
|
|
||||||
#define EGL_MESA_drm_image 1
|
|
||||||
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
|
|
||||||
#define EGL_DRM_BUFFER_USE_MESA 0x31D1
|
|
||||||
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
|
|
||||||
#define EGL_DRM_BUFFER_MESA 0x31D3
|
|
||||||
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
|
|
||||||
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
|
|
||||||
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
|
|
||||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_MESA_drm_image */
|
|
||||||
|
|
||||||
#ifndef EGL_MESA_platform_gbm
|
|
||||||
#define EGL_MESA_platform_gbm 1
|
|
||||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
|
||||||
#endif /* EGL_MESA_platform_gbm */
|
|
||||||
|
|
||||||
#ifndef EGL_NOK_swap_region
|
|
||||||
#define EGL_NOK_swap_region 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_NOK_swap_region */
|
|
||||||
|
|
||||||
#ifndef EGL_NOK_swap_region2
|
|
||||||
#define EGL_NOK_swap_region2 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_NOK_swap_region2 */
|
|
||||||
|
|
||||||
#ifndef EGL_NOK_texture_from_pixmap
|
|
||||||
#define EGL_NOK_texture_from_pixmap 1
|
|
||||||
#define EGL_Y_INVERTED_NOK 0x307F
|
|
||||||
#endif /* EGL_NOK_texture_from_pixmap */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_3dvision_surface
|
|
||||||
#define EGL_NV_3dvision_surface 1
|
|
||||||
#define EGL_AUTO_STEREO_NV 0x3136
|
|
||||||
#endif /* EGL_NV_3dvision_surface */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_coverage_sample
|
|
||||||
#define EGL_NV_coverage_sample 1
|
|
||||||
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
|
|
||||||
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
|
|
||||||
#endif /* EGL_NV_coverage_sample */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_coverage_sample_resolve
|
|
||||||
#define EGL_NV_coverage_sample_resolve 1
|
|
||||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
|
|
||||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
|
|
||||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
|
|
||||||
#endif /* EGL_NV_coverage_sample_resolve */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_cuda_event
|
|
||||||
#define EGL_NV_cuda_event 1
|
|
||||||
#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
|
|
||||||
#define EGL_SYNC_CUDA_EVENT_NV 0x323C
|
|
||||||
#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
|
|
||||||
#endif /* EGL_NV_cuda_event */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_depth_nonlinear
|
|
||||||
#define EGL_NV_depth_nonlinear 1
|
|
||||||
#define EGL_DEPTH_ENCODING_NV 0x30E2
|
|
||||||
#define EGL_DEPTH_ENCODING_NONE_NV 0
|
|
||||||
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
|
|
||||||
#endif /* EGL_NV_depth_nonlinear */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_device_cuda
|
|
||||||
#define EGL_NV_device_cuda 1
|
|
||||||
#define EGL_CUDA_DEVICE_NV 0x323A
|
|
||||||
#endif /* EGL_NV_device_cuda */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_native_query
|
|
||||||
#define EGL_NV_native_query 1
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_NV_native_query */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_post_convert_rounding
|
|
||||||
#define EGL_NV_post_convert_rounding 1
|
|
||||||
#endif /* EGL_NV_post_convert_rounding */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_post_sub_buffer
|
|
||||||
#define EGL_NV_post_sub_buffer 1
|
|
||||||
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_NV_post_sub_buffer */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_stream_sync
|
|
||||||
#define EGL_NV_stream_sync 1
|
|
||||||
#define EGL_SYNC_NEW_FRAME_NV 0x321F
|
|
||||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
|
|
||||||
#endif
|
|
||||||
#endif /* EGL_NV_stream_sync */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_sync
|
|
||||||
#define EGL_NV_sync 1
|
|
||||||
typedef void *EGLSyncNV;
|
|
||||||
typedef khronos_utime_nanoseconds_t EGLTimeNV;
|
|
||||||
#ifdef KHRONOS_SUPPORT_INT64
|
|
||||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
|
|
||||||
#define EGL_SYNC_STATUS_NV 0x30E7
|
|
||||||
#define EGL_SIGNALED_NV 0x30E8
|
|
||||||
#define EGL_UNSIGNALED_NV 0x30E9
|
|
||||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
|
|
||||||
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
|
|
||||||
#define EGL_ALREADY_SIGNALED_NV 0x30EA
|
|
||||||
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
|
|
||||||
#define EGL_CONDITION_SATISFIED_NV 0x30EC
|
|
||||||
#define EGL_SYNC_TYPE_NV 0x30ED
|
|
||||||
#define EGL_SYNC_CONDITION_NV 0x30EE
|
|
||||||
#define EGL_SYNC_FENCE_NV 0x30EF
|
|
||||||
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
|
|
||||||
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
|
|
||||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
|
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
|
|
||||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
|
|
||||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
|
||||||
#endif
|
|
||||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
|
||||||
#endif /* EGL_NV_sync */
|
|
||||||
|
|
||||||
#ifndef EGL_NV_system_time
|
|
||||||
#define EGL_NV_system_time 1
|
|
||||||
typedef khronos_utime_nanoseconds_t EGLuint64NV;
|
|
||||||
#ifdef KHRONOS_SUPPORT_INT64
|
|
||||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
|
|
||||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
|
|
||||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
|
||||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
|
|
||||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
|
|
||||||
#endif
|
|
||||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
|
||||||
#endif /* EGL_NV_system_time */
|
|
||||||
|
|
||||||
#ifndef EGL_TIZEN_image_native_buffer
|
|
||||||
#define EGL_TIZEN_image_native_buffer 1
|
|
||||||
#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
|
|
||||||
#endif /* EGL_TIZEN_image_native_buffer */
|
|
||||||
|
|
||||||
#ifndef EGL_TIZEN_image_native_surface
|
|
||||||
#define EGL_TIZEN_image_native_surface 1
|
|
||||||
#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
|
|
||||||
#endif /* EGL_TIZEN_image_native_surface */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,125 +0,0 @@
|
||||||
#ifndef __eglplatform_h_
|
|
||||||
#define __eglplatform_h_
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Copyright (c) 2007-2013 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Platform-specific types and definitions for egl.h
|
|
||||||
* $Revision: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
|
|
||||||
*
|
|
||||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
|
||||||
* You are encouraged to submit all modifications to the Khronos group so that
|
|
||||||
* they can be included in future versions of this file. Please submit changes
|
|
||||||
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
|
|
||||||
* by filing a bug against product "EGL" component "Registry".
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <KHR/khrplatform.h>
|
|
||||||
|
|
||||||
/* Macros used in EGL function prototype declarations.
|
|
||||||
*
|
|
||||||
* EGL functions should be prototyped as:
|
|
||||||
*
|
|
||||||
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
|
|
||||||
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
|
|
||||||
*
|
|
||||||
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EGLAPI
|
|
||||||
#define EGLAPI KHRONOS_APICALL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EGLAPIENTRY
|
|
||||||
#define EGLAPIENTRY KHRONOS_APIENTRY
|
|
||||||
#endif
|
|
||||||
#define EGLAPIENTRYP EGLAPIENTRY*
|
|
||||||
|
|
||||||
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
|
|
||||||
* are aliases of window-system-dependent types, such as X Display * or
|
|
||||||
* Windows Device Context. They must be defined in platform-specific
|
|
||||||
* code below. The EGL-prefixed versions of Native*Type are the same
|
|
||||||
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
|
|
||||||
*
|
|
||||||
* Khronos STRONGLY RECOMMENDS that you use the default definitions
|
|
||||||
* provided below, since these changes affect both binary and source
|
|
||||||
* portability of applications using EGL running on different EGL
|
|
||||||
* implementations.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN 1
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
typedef HDC EGLNativeDisplayType;
|
|
||||||
typedef HBITMAP EGLNativePixmapType;
|
|
||||||
typedef HWND EGLNativeWindowType;
|
|
||||||
|
|
||||||
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
|
|
||||||
|
|
||||||
typedef int EGLNativeDisplayType;
|
|
||||||
typedef void *EGLNativeWindowType;
|
|
||||||
typedef void *EGLNativePixmapType;
|
|
||||||
|
|
||||||
#elif defined(__ANDROID__) || defined(ANDROID)
|
|
||||||
|
|
||||||
#include <android/native_window.h>
|
|
||||||
|
|
||||||
struct egl_native_pixmap_t;
|
|
||||||
|
|
||||||
typedef struct ANativeWindow* EGLNativeWindowType;
|
|
||||||
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
|
||||||
typedef void* EGLNativeDisplayType;
|
|
||||||
|
|
||||||
#elif defined(__unix__) || defined(__APPLE__)
|
|
||||||
|
|
||||||
/* X11 (tentative) */
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/Xutil.h>
|
|
||||||
|
|
||||||
typedef Display *EGLNativeDisplayType;
|
|
||||||
typedef Pixmap EGLNativePixmapType;
|
|
||||||
typedef Window EGLNativeWindowType;
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error "Platform not recognized"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
|
|
||||||
typedef EGLNativeDisplayType NativeDisplayType;
|
|
||||||
typedef EGLNativePixmapType NativePixmapType;
|
|
||||||
typedef EGLNativeWindowType NativeWindowType;
|
|
||||||
|
|
||||||
|
|
||||||
/* Define EGLint. This must be a signed integral type large enough to contain
|
|
||||||
* all legal attribute names and values passed into and out of EGL, whether
|
|
||||||
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
|
|
||||||
* handle, or other. While in general a 32-bit integer will suffice, if
|
|
||||||
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
|
|
||||||
* integer type.
|
|
||||||
*/
|
|
||||||
typedef khronos_int32_t EGLint;
|
|
||||||
|
|
||||||
#endif /* __eglplatform_h */
|
|
|
@ -232,6 +232,40 @@ void GLBuffer::Resize(size_t newsize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLBuffer::GPUDropSync()
|
||||||
|
{
|
||||||
|
#if !(USE_GLES2) // Only applicable when running on desktop for now
|
||||||
|
if (gles.useMappedBuffers && glFenceSync && glClientWaitSync)
|
||||||
|
{
|
||||||
|
if (mGLSync != NULL)
|
||||||
|
{
|
||||||
|
glDeleteSync(mGLSync);
|
||||||
|
}
|
||||||
|
|
||||||
|
mGLSync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLBuffer::GPUWaitSync()
|
||||||
|
{
|
||||||
|
#if !(USE_GLES2) // Only applicable when running on desktop for now
|
||||||
|
if (gles.useMappedBuffers && glFenceSync && glClientWaitSync)
|
||||||
|
{
|
||||||
|
GLenum status = glClientWaitSync(mGLSync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000 * 1000 * 50); // Wait for a max of 50ms...
|
||||||
|
|
||||||
|
if (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED)
|
||||||
|
{
|
||||||
|
//Printf("Error on glClientWaitSync: %d\n", status);
|
||||||
|
}
|
||||||
|
|
||||||
|
glDeleteSync(mGLSync);
|
||||||
|
|
||||||
|
mGLSync = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
@ -287,16 +321,12 @@ void GLDataBuffer::BindRange(FRenderState *state, size_t start, size_t length)
|
||||||
if (mBindingPoint == 3)// VIEWPOINT_BINDINGPOINT
|
if (mBindingPoint == 3)// VIEWPOINT_BINDINGPOINT
|
||||||
{
|
{
|
||||||
static_cast<FGLRenderState*>(state)->ApplyViewport(memory + start);
|
static_cast<FGLRenderState*>(state)->ApplyViewport(memory + start);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//glBindBufferRange(mUseType, mBindingPoint, mBufferId, start, length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLDataBuffer::BindBase()
|
void GLDataBuffer::BindBase()
|
||||||
{
|
{
|
||||||
//glBindBufferBase(mUseType, mBindingPoint, mBufferId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ protected:
|
||||||
int mAllocationSize = 0;
|
int mAllocationSize = 0;
|
||||||
bool mPersistent = false;
|
bool mPersistent = false;
|
||||||
bool nomap = true;
|
bool nomap = true;
|
||||||
|
GLsync mGLSync = 0;
|
||||||
|
|
||||||
bool isData = false;
|
bool isData = false;
|
||||||
char *memory = nullptr;
|
char *memory = nullptr;
|
||||||
|
@ -32,6 +33,9 @@ protected:
|
||||||
void Resize(size_t newsize) override;
|
void Resize(size_t newsize) override;
|
||||||
void *Lock(unsigned int size) override;
|
void *Lock(unsigned int size) override;
|
||||||
void Unlock() override;
|
void Unlock() override;
|
||||||
|
|
||||||
|
void GPUDropSync();
|
||||||
|
void GPUWaitSync();
|
||||||
public:
|
public:
|
||||||
void Bind();
|
void Bind();
|
||||||
void Upload(size_t start, size_t end);
|
void Upload(size_t start, size_t end);
|
||||||
|
|
|
@ -240,11 +240,13 @@ void OpenGLFrameBuffer::Swap()
|
||||||
Finish.Reset();
|
Finish.Reset();
|
||||||
Finish.Clock();
|
Finish.Clock();
|
||||||
|
|
||||||
|
mVertexData->DropSync();
|
||||||
|
|
||||||
FPSLimit();
|
FPSLimit();
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
mVertexData->NextPipelineBuffer();
|
mVertexData->NextPipelineBuffer();
|
||||||
|
mVertexData->WaitSync();
|
||||||
|
|
||||||
RenderState()->SetVertexBuffer(screen->mVertexData); // Needed for Raze because it does not reset it
|
RenderState()->SetVertexBuffer(screen->mVertexData); // Needed for Raze because it does not reset it
|
||||||
|
|
||||||
|
|
|
@ -92,11 +92,16 @@ bool FGLRenderState::ApplyShader()
|
||||||
{
|
{
|
||||||
static const float nulvec[] = { 0.f, 0.f, 0.f, 0.f };
|
static const float nulvec[] = { 0.f, 0.f, 0.f, 0.f };
|
||||||
|
|
||||||
|
ShaderFlavourData flavour;
|
||||||
|
|
||||||
// Need to calc light data now in order to select correct shader
|
// Need to calc light data now in order to select correct shader
|
||||||
float* lightPtr = NULL;
|
float* lightPtr = NULL;
|
||||||
int modLights = 0;
|
int modLights = 0;
|
||||||
int subLights = 0;
|
int subLights = 0;
|
||||||
int addLights = 0;
|
int addLights = 0;
|
||||||
|
int totalLights = 0;
|
||||||
|
|
||||||
|
flavour.hasSpotLight = false;
|
||||||
|
|
||||||
if (mLightIndex >= 0)
|
if (mLightIndex >= 0)
|
||||||
{
|
{
|
||||||
|
@ -119,21 +124,35 @@ bool FGLRenderState::ApplyShader()
|
||||||
|
|
||||||
if (modLights + subLights + addLights > gles.maxlights)
|
if (modLights + subLights + addLights > gles.maxlights)
|
||||||
addLights = gles.maxlights - modLights - subLights;
|
addLights = gles.maxlights - modLights - subLights;
|
||||||
|
|
||||||
|
totalLights = modLights + subLights + addLights;
|
||||||
|
|
||||||
// Skip passed the first 4 floats so the upload below only contains light data
|
// Skip passed the first 4 floats so the upload below only contains light data
|
||||||
lightPtr += 4;
|
lightPtr += 4;
|
||||||
|
|
||||||
|
float* findSpotsPtr = lightPtr + 11; // The 11th float contains '1' if the light is a spot light, see hw_dynlightdata.cpp
|
||||||
|
|
||||||
|
for (int n = 0; n < totalLights; n++)
|
||||||
|
{
|
||||||
|
if (*findSpotsPtr > 0) // This is a spot light
|
||||||
|
{
|
||||||
|
flavour.hasSpotLight = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
findSpotsPtr += LIGHT_VEC4_NUM * 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderFlavourData flavour;
|
|
||||||
|
|
||||||
flavour.textureMode = (mTextureMode == TM_NORMAL && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode);
|
int tm = GetTextureModeAndFlags(mTempTM);
|
||||||
|
flavour.textureMode = tm & 0xffff;
|
||||||
|
flavour.texFlags = tm >> 16; //Move flags to start of word
|
||||||
|
|
||||||
|
if (mTextureClamp && flavour.textureMode == TM_NORMAL) flavour.textureMode = TM_CLAMPY; // fixme. Clamp can now be combined with all modes.
|
||||||
|
|
||||||
if (flavour.textureMode == -1)
|
if (flavour.textureMode == -1)
|
||||||
flavour.textureMode = 0;
|
flavour.textureMode = 0;
|
||||||
|
|
||||||
flavour.texFlags = mTextureModeFlags; if (!mBrightmapEnabled) flavour.texFlags &= ~(TEXF_Brightmap | TEXF_Glowmap);
|
|
||||||
flavour.texFlags >>= 16; //Move flags to start of word
|
|
||||||
|
|
||||||
flavour.blendFlags = (int)(mStreamData.uTextureAddColor.a + 0.01);
|
flavour.blendFlags = (int)(mStreamData.uTextureAddColor.a + 0.01);
|
||||||
|
|
||||||
|
@ -198,14 +217,10 @@ bool FGLRenderState::ApplyShader()
|
||||||
|
|
||||||
if (mHwUniforms)
|
if (mHwUniforms)
|
||||||
{
|
{
|
||||||
//matrixToGL(mHwUniforms->mProjectionMatrix, activeShader->cur->ProjectionMatrix_index);
|
|
||||||
activeShader->cur->muProjectionMatrix.Set(&mHwUniforms->mProjectionMatrix);
|
activeShader->cur->muProjectionMatrix.Set(&mHwUniforms->mProjectionMatrix);
|
||||||
activeShader->cur->muViewMatrix.Set(&mHwUniforms->mViewMatrix);
|
activeShader->cur->muViewMatrix.Set(&mHwUniforms->mViewMatrix);
|
||||||
activeShader->cur->muNormalViewMatrix.Set(&mHwUniforms->mNormalViewMatrix);
|
activeShader->cur->muNormalViewMatrix.Set(&mHwUniforms->mNormalViewMatrix);
|
||||||
|
|
||||||
//matrixToGL(mHwUniforms->mViewMatrix, activeShader->cur->ViewMatrix_index);
|
|
||||||
//matrixToGL(mHwUniforms->mNormalViewMatrix, activeShader->cur->NormalViewMatrix_index);
|
|
||||||
|
|
||||||
activeShader->cur->muCameraPos.Set(&mHwUniforms->mCameraPos.X);
|
activeShader->cur->muCameraPos.Set(&mHwUniforms->mCameraPos.X);
|
||||||
activeShader->cur->muClipLine.Set(&mHwUniforms->mClipLine.X);
|
activeShader->cur->muClipLine.Set(&mHwUniforms->mClipLine.X);
|
||||||
|
|
||||||
|
@ -224,9 +239,6 @@ bool FGLRenderState::ApplyShader()
|
||||||
activeShader->cur->muDesaturation.Set(mStreamData.uDesaturationFactor);
|
activeShader->cur->muDesaturation.Set(mStreamData.uDesaturationFactor);
|
||||||
//activeShader->cur->muFogEnabled.Set(fogset);
|
//activeShader->cur->muFogEnabled.Set(fogset);
|
||||||
|
|
||||||
int f = mTextureModeFlags;
|
|
||||||
if (!mBrightmapEnabled) f &= ~(TEXF_Brightmap | TEXF_Glowmap);
|
|
||||||
//activeShader->cur->muTextureMode.Set((mTextureMode == TM_NORMAL && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode) | f);
|
|
||||||
activeShader->cur->muLightParms.Set(mLightParms);
|
activeShader->cur->muLightParms.Set(mLightParms);
|
||||||
activeShader->cur->muFogColor.Set(mStreamData.uFogColor);
|
activeShader->cur->muFogColor.Set(mStreamData.uFogColor);
|
||||||
activeShader->cur->muObjectColor.Set(mStreamData.uObjectColor);
|
activeShader->cur->muObjectColor.Set(mStreamData.uObjectColor);
|
||||||
|
@ -317,13 +329,9 @@ bool FGLRenderState::ApplyShader()
|
||||||
// Upload the light data
|
// Upload the light data
|
||||||
if (mLightIndex >= 0)
|
if (mLightIndex >= 0)
|
||||||
{
|
{
|
||||||
int totalLights = modLights + subLights + addLights;
|
|
||||||
|
|
||||||
// Calculate the total number of vec4s we need
|
// Calculate the total number of vec4s we need
|
||||||
int totalVectors = totalLights * LIGHT_VEC4_NUM;
|
int totalVectors = totalLights * LIGHT_VEC4_NUM;
|
||||||
|
|
||||||
// TODO!!! If there are too many lights we need to remove some of the lights and modify the data
|
|
||||||
// At the moment the shader will just try to read off the end of the array...
|
|
||||||
if (totalVectors > gles.numlightvectors)
|
if (totalVectors > gles.numlightvectors)
|
||||||
totalVectors = gles.numlightvectors;
|
totalVectors = gles.numlightvectors;
|
||||||
|
|
||||||
|
|
|
@ -633,11 +633,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
||||||
char stringbuf[20];
|
char stringbuf[20];
|
||||||
mysnprintf(stringbuf, 20, "texture%d", i);
|
mysnprintf(stringbuf, 20, "texture%d", i);
|
||||||
int tempindex = glGetUniformLocation(shaderData->hShader, stringbuf);
|
int tempindex = glGetUniformLocation(shaderData->hShader, stringbuf);
|
||||||
if (tempindex > 0) glUniform1i(tempindex, i - 1);
|
if (tempindex >= 0) glUniform1i(tempindex, i - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int shadowmapindex = glGetUniformLocation(shaderData->hShader, "ShadowMap");
|
int shadowmapindex = glGetUniformLocation(shaderData->hShader, "ShadowMap");
|
||||||
if (shadowmapindex > 0) glUniform1i(shadowmapindex, 16);
|
if (shadowmapindex >= 0) glUniform1i(shadowmapindex, 16);
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
|
@ -654,13 +654,17 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
||||||
|
|
||||||
FShader::~FShader()
|
FShader::~FShader()
|
||||||
{
|
{
|
||||||
/*
|
std::map<uint32_t, ShaderVariantData*>::iterator it = variants.begin();
|
||||||
glDeleteProgram(hShader);
|
|
||||||
if (hVertProg != 0)
|
while (it != variants.end())
|
||||||
glDeleteShader(hVertProg);
|
{
|
||||||
if (hFragProg != 0)
|
glDeleteProgram(it->second->hShader);
|
||||||
glDeleteShader(hFragProg);
|
if (it->second->hVertProg != 0)
|
||||||
*/
|
glDeleteShader(it->second->hVertProg);
|
||||||
|
if (it->second->hFragProg != 0)
|
||||||
|
glDeleteShader(it->second->hFragProg);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -710,14 +714,13 @@ bool FShader::Bind(ShaderFlavourData& flavour)
|
||||||
variantConfig.AppendFormat("#define DEF_NPOT_EMULATION %d\n", flavour.npotEmulation);
|
variantConfig.AppendFormat("#define DEF_NPOT_EMULATION %d\n", flavour.npotEmulation);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Printf("Shader: %s, %08x %s", mFragProg2.GetChars(), tag, variantConfig.GetChars());
|
variantConfig.AppendFormat("#define DEF_HAS_SPOTLIGHT %d\n", flavour.hasSpotLight);
|
||||||
|
|
||||||
|
//Printf("Shader: %s, %08x %s", mFragProg2.GetChars(), tag, variantConfig.GetChars());
|
||||||
|
|
||||||
Load(mName.GetChars(), mVertProg, mFragProg, mFragProg2, mLightProg, mDefinesBase + variantConfig);
|
Load(mName.GetChars(), mVertProg, mFragProg, mFragProg2, mLightProg, mDefinesBase + variantConfig);
|
||||||
|
|
||||||
if (variants.insert(std::make_pair(tag, cur)).second == false)
|
variants.insert(std::make_pair(tag, cur));
|
||||||
{
|
|
||||||
Printf("ERROR INSERTING");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -275,6 +275,8 @@ public:
|
||||||
#ifdef NPOT_EMULATION
|
#ifdef NPOT_EMULATION
|
||||||
bool npotEmulation;
|
bool npotEmulation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool hasSpotLight;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FShader
|
class FShader
|
||||||
|
@ -417,6 +419,9 @@ public:
|
||||||
#ifdef NPOT_EMULATION
|
#ifdef NPOT_EMULATION
|
||||||
tag |= (flavour.npotEmulation & 1) << 22;
|
tag |= (flavour.npotEmulation & 1) << 22;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tag |= (flavour.hasSpotLight & 1) << 23;
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ EXTERN_CVAR(Bool, gl_customshader);
|
||||||
|
|
||||||
PFNGLMAPBUFFERRANGEEXTPROC glMapBufferRange = NULL;
|
PFNGLMAPBUFFERRANGEEXTPROC glMapBufferRange = NULL;
|
||||||
PFNGLUNMAPBUFFEROESPROC glUnmapBuffer = NULL;
|
PFNGLUNMAPBUFFEROESPROC glUnmapBuffer = NULL;
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ namespace OpenGLESRenderer
|
||||||
Printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
|
Printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
|
||||||
Printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
|
Printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
|
||||||
Printf("GL_SHADING_LANGUAGE_VERSION: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
Printf("GL_SHADING_LANGUAGE_VERSION: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||||
Printf("GL_EXTENSIONS:\n");
|
Printf(PRINT_LOG, "GL_EXTENSIONS:\n");
|
||||||
for (unsigned i = 0; i < m_Extensions.Size(); i++)
|
for (unsigned i = 0; i < m_Extensions.Size(); i++)
|
||||||
{
|
{
|
||||||
Printf(" %s\n", m_Extensions[i].GetChars());
|
Printf(" %s\n", m_Extensions[i].GetChars());
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
class FRenderState;
|
class FRenderState;
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#define HW_MAX_PIPELINE_BUFFERS 8
|
#define HW_MAX_PIPELINE_BUFFERS 4
|
||||||
#define HW_BLOCK_SSBO 1
|
#define HW_BLOCK_SSBO 1
|
||||||
#else
|
#else
|
||||||
// On desktop this is only useful fpr letting the GPU run in parallel with the playsim and for that 2 buffers are enough.
|
// On desktop this is only useful fpr letting the GPU run in parallel with the playsim and for that 2 buffers are enough.
|
||||||
|
|
|
@ -219,6 +219,7 @@ protected:
|
||||||
int mLightIndex;
|
int mLightIndex;
|
||||||
int mSpecialEffect;
|
int mSpecialEffect;
|
||||||
int mTextureMode;
|
int mTextureMode;
|
||||||
|
int mTextureClamp;
|
||||||
int mTextureModeFlags;
|
int mTextureModeFlags;
|
||||||
int mSoftLight;
|
int mSoftLight;
|
||||||
float mLightParms[4];
|
float mLightParms[4];
|
||||||
|
@ -259,6 +260,7 @@ public:
|
||||||
mFogColor = 0xffffffff;
|
mFogColor = 0xffffffff;
|
||||||
mStreamData.uFogColor = mFogColor;
|
mStreamData.uFogColor = mFogColor;
|
||||||
mTextureMode = -1;
|
mTextureMode = -1;
|
||||||
|
mTextureClamp = 0;
|
||||||
mTextureModeFlags = 0;
|
mTextureModeFlags = 0;
|
||||||
mStreamData.uDesaturationFactor = 0.0f;
|
mStreamData.uDesaturationFactor = 0.0f;
|
||||||
mAlphaThreshold = 0.5f;
|
mAlphaThreshold = 0.5f;
|
||||||
|
@ -344,12 +346,18 @@ public:
|
||||||
mStreamData.uDesaturationFactor = 0.0f;
|
mStreamData.uDesaturationFactor = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetTextureClamp(bool on)
|
||||||
|
{
|
||||||
|
if (on) mTextureClamp = TM_CLAMPY;
|
||||||
|
else mTextureClamp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void SetTextureMode(int mode)
|
void SetTextureMode(int mode)
|
||||||
{
|
{
|
||||||
mTextureMode = mode;
|
mTextureMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTextureMode(FRenderStyle style, bool clampy = false)
|
void SetTextureMode(FRenderStyle style)
|
||||||
{
|
{
|
||||||
if (style.Flags & STYLEF_RedIsAlpha)
|
if (style.Flags & STYLEF_RedIsAlpha)
|
||||||
{
|
{
|
||||||
|
@ -363,7 +371,6 @@ public:
|
||||||
{
|
{
|
||||||
SetTextureMode(TM_INVERSE);
|
SetTextureMode(TM_INVERSE);
|
||||||
}
|
}
|
||||||
if (clampy) mTextureMode |= TM_CLAMPY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetTextureMode()
|
int GetTextureMode()
|
||||||
|
@ -371,6 +378,14 @@ public:
|
||||||
return mTextureMode;
|
return mTextureMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetTextureModeAndFlags(int tempTM)
|
||||||
|
{
|
||||||
|
int f = mTextureModeFlags;
|
||||||
|
if (!mBrightmapEnabled) f &= ~(TEXF_Brightmap | TEXF_Glowmap);
|
||||||
|
if (mTextureClamp) f |= TEXF_ClampY;
|
||||||
|
return (mTextureMode == TM_NORMAL && tempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode) | f;
|
||||||
|
}
|
||||||
|
|
||||||
void EnableTexture(bool on)
|
void EnableTexture(bool on)
|
||||||
{
|
{
|
||||||
mTextureEnabled = on;
|
mTextureEnabled = on;
|
||||||
|
|
|
@ -287,7 +287,7 @@ void PolyRenderState::Apply()
|
||||||
|
|
||||||
PolyPushConstants constants;
|
PolyPushConstants constants;
|
||||||
constants.uFogEnabled = fogset;
|
constants.uFogEnabled = fogset;
|
||||||
constants.uTextureMode = (mTextureMode == TM_NORMAL && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode);
|
constants.uTextureMode = GetTextureModeAndFlags(mTempTM);
|
||||||
constants.uLightDist = mLightParms[0];
|
constants.uLightDist = mLightParms[0];
|
||||||
constants.uLightFactor = mLightParms[1];
|
constants.uLightFactor = mLightParms[1];
|
||||||
constants.uFogDensity = mLightParms[2];
|
constants.uFogDensity = mLightParms[2];
|
||||||
|
|
|
@ -371,9 +371,7 @@ void VkRenderState::ApplyPushConstants()
|
||||||
tempTM = TM_OPAQUE;
|
tempTM = TM_OPAQUE;
|
||||||
|
|
||||||
mPushConstants.uFogEnabled = fogset;
|
mPushConstants.uFogEnabled = fogset;
|
||||||
int f = mTextureModeFlags;
|
mPushConstants.uTextureMode = GetTextureModeAndFlags(tempTM);
|
||||||
if (!mBrightmapEnabled) f &= ~(TEXF_Brightmap|TEXF_Glowmap);
|
|
||||||
mPushConstants.uTextureMode = (mTextureMode == TM_NORMAL && tempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode) | f;
|
|
||||||
mPushConstants.uLightDist = mLightParms[0];
|
mPushConstants.uLightDist = mLightParms[0];
|
||||||
mPushConstants.uLightFactor = mLightParms[1];
|
mPushConstants.uLightFactor = mLightParms[1];
|
||||||
mPushConstants.uFogDensity = mLightParms[2];
|
mPushConstants.uFogDensity = mLightParms[2];
|
||||||
|
|
|
@ -92,6 +92,7 @@ enum texflags
|
||||||
TEXF_Brightmap = 0x10000,
|
TEXF_Brightmap = 0x10000,
|
||||||
TEXF_Detailmap = 0x20000,
|
TEXF_Detailmap = 0x20000,
|
||||||
TEXF_Glowmap = 0x40000,
|
TEXF_Glowmap = 0x40000,
|
||||||
|
TEXF_ClampY = 0x80000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
layout(location = 0) in vec4 vTexCoord;
|
layout(location = 0) in vec4 vTexCoord;
|
||||||
layout(location = 1) in vec4 vColor;
|
layout(location = 1) in vec4 vColor;
|
||||||
layout(location = 2) in vec4 pixelpos;
|
layout(location = 2) in vec4 pixelpos;
|
||||||
|
@ -44,6 +45,7 @@ vec2 GetTexCoord();
|
||||||
const int TEXF_Brightmap = 0x10000;
|
const int TEXF_Brightmap = 0x10000;
|
||||||
const int TEXF_Detailmap = 0x20000;
|
const int TEXF_Detailmap = 0x20000;
|
||||||
const int TEXF_Glowmap = 0x40000;
|
const int TEXF_Glowmap = 0x40000;
|
||||||
|
const int TEXF_ClampY = 0x80000;
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
@ -165,7 +167,7 @@ vec4 getTexel(vec2 st)
|
||||||
//
|
//
|
||||||
// Apply texture modes
|
// Apply texture modes
|
||||||
//
|
//
|
||||||
switch (uTextureMode & 0xfff)
|
switch (uTextureMode & 0xffff)
|
||||||
{
|
{
|
||||||
case 1: // TM_STENCIL
|
case 1: // TM_STENCIL
|
||||||
texel.rgb = vec3(1.0,1.0,1.0);
|
texel.rgb = vec3(1.0,1.0,1.0);
|
||||||
|
@ -186,6 +188,13 @@ vec4 getTexel(vec2 st)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 5: // TM_CLAMPY
|
||||||
|
if (st.t < 0.0 || st.t > 1.0)
|
||||||
|
{
|
||||||
|
texel.a = 0.0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 6: // TM_OPAQUEINVERSE
|
case 6: // TM_OPAQUEINVERSE
|
||||||
texel = vec4(1.0-texel.r, 1.0-texel.b, 1.0-texel.g, 1.0);
|
texel = vec4(1.0-texel.r, 1.0-texel.b, 1.0-texel.g, 1.0);
|
||||||
break;
|
break;
|
||||||
|
@ -194,7 +203,8 @@ vec4 getTexel(vec2 st)
|
||||||
return texel;
|
return texel;
|
||||||
|
|
||||||
}
|
}
|
||||||
if ((uTextureMode & 0x1000) != 0) // TM_CLAMPY
|
|
||||||
|
if ((uTextureMode & TEXF_ClampY) != 0)
|
||||||
{
|
{
|
||||||
if (st.t < 0.0 || st.t > 1.0)
|
if (st.t < 0.0 || st.t > 1.0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,195 +0,0 @@
|
||||||
|
|
||||||
const float PI = 3.14159265359;
|
|
||||||
|
|
||||||
float DistributionGGX(vec3 N, vec3 H, float roughness)
|
|
||||||
{
|
|
||||||
float a = roughness * roughness;
|
|
||||||
float a2 = a * a;
|
|
||||||
float NdotH = max(dot(N, H), 0.0);
|
|
||||||
float NdotH2 = NdotH*NdotH;
|
|
||||||
|
|
||||||
float nom = a2;
|
|
||||||
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
|
|
||||||
denom = PI * denom * denom;
|
|
||||||
|
|
||||||
return nom / denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
float GeometrySchlickGGX(float NdotV, float roughness)
|
|
||||||
{
|
|
||||||
float r = (roughness + 1.0);
|
|
||||||
float k = (r * r) / 8.0;
|
|
||||||
|
|
||||||
float nom = NdotV;
|
|
||||||
float denom = NdotV * (1.0 - k) + k;
|
|
||||||
|
|
||||||
return nom / denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
float GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)
|
|
||||||
{
|
|
||||||
float NdotV = max(dot(N, V), 0.0);
|
|
||||||
float NdotL = max(dot(N, L), 0.0);
|
|
||||||
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
|
||||||
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
|
||||||
return ggx1 * ggx2;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 fresnelSchlick(float cosTheta, vec3 F0)
|
|
||||||
{
|
|
||||||
return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness)
|
|
||||||
{
|
|
||||||
return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(1.0 - cosTheta, 5.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
float quadraticDistanceAttenuation(vec4 lightpos)
|
|
||||||
{
|
|
||||||
float strength = (1.0 + lightpos.w * lightpos.w * 0.25) * 0.5;
|
|
||||||
|
|
||||||
vec3 distVec = lightpos.xyz - pixelpos.xyz;
|
|
||||||
float attenuation = strength / (1.0 + dot(distVec, distVec));
|
|
||||||
if (attenuation <= 1.0 / 256.0) return 0.0;
|
|
||||||
|
|
||||||
return attenuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
float linearDistanceAttenuation(vec4 lightpos)
|
|
||||||
{
|
|
||||||
float lightdistance = distance(lightpos.xyz, pixelpos.xyz);
|
|
||||||
return clamp((lightpos.w - lightdistance) / lightpos.w, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 ProcessMaterialLight(Material material, vec3 ambientLight)
|
|
||||||
{
|
|
||||||
vec3 worldpos = pixelpos.xyz;
|
|
||||||
|
|
||||||
vec3 albedo = pow(material.Base.rgb, vec3(2.2)); // sRGB to linear
|
|
||||||
ambientLight = pow(ambientLight, vec3(2.2));
|
|
||||||
|
|
||||||
float metallic = material.Metallic;
|
|
||||||
float roughness = material.Roughness;
|
|
||||||
float ao = material.AO;
|
|
||||||
|
|
||||||
vec3 N = material.Normal;
|
|
||||||
vec3 V = normalize(uCameraPos.xyz - worldpos);
|
|
||||||
|
|
||||||
vec3 F0 = mix(vec3(0.04), albedo, metallic);
|
|
||||||
|
|
||||||
vec3 Lo = uDynLightColor.rgb;
|
|
||||||
|
|
||||||
if (uLightIndex >= 0)
|
|
||||||
{
|
|
||||||
ivec4 lightRange = ivec4(lights[uLightIndex]) + ivec4(uLightIndex + 1);
|
|
||||||
if (lightRange.z > lightRange.x)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// modulated lights
|
|
||||||
//
|
|
||||||
for(int i=lightRange.x; i<lightRange.y; i+=4)
|
|
||||||
{
|
|
||||||
vec4 lightpos = lights[i];
|
|
||||||
vec4 lightcolor = lights[i+1];
|
|
||||||
vec4 lightspot1 = lights[i+2];
|
|
||||||
vec4 lightspot2 = lights[i+3];
|
|
||||||
|
|
||||||
vec3 L = normalize(lightpos.xyz - worldpos);
|
|
||||||
vec3 H = normalize(V + L);
|
|
||||||
|
|
||||||
float attenuation = linearDistanceAttenuation(lightpos);
|
|
||||||
if (lightspot1.w == 1.0)
|
|
||||||
attenuation *= spotLightAttenuation(lightpos, lightspot1.xyz, lightspot2.x, lightspot2.y);
|
|
||||||
if (lightcolor.a < 0.0)
|
|
||||||
attenuation *= clamp(dot(N, L), 0.0, 1.0); // Sign bit is the attenuated light flag
|
|
||||||
|
|
||||||
if (attenuation > 0.0)
|
|
||||||
{
|
|
||||||
attenuation *= shadowAttenuation(lightpos, lightcolor.a);
|
|
||||||
|
|
||||||
vec3 radiance = lightcolor.rgb * attenuation;
|
|
||||||
|
|
||||||
// cook-torrance brdf
|
|
||||||
float NDF = DistributionGGX(N, H, roughness);
|
|
||||||
float G = GeometrySmith(N, V, L, roughness);
|
|
||||||
vec3 F = fresnelSchlick(clamp(dot(H, V), 0.0, 1.0), F0);
|
|
||||||
|
|
||||||
vec3 kS = F;
|
|
||||||
vec3 kD = (vec3(1.0) - kS) * (1.0 - metallic);
|
|
||||||
|
|
||||||
vec3 nominator = NDF * G * F;
|
|
||||||
float denominator = 4.0 * clamp(dot(N, V), 0.0, 1.0) * clamp(dot(N, L), 0.0, 1.0);
|
|
||||||
vec3 specular = nominator / max(denominator, 0.001);
|
|
||||||
|
|
||||||
Lo += (kD * albedo / PI + specular) * radiance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// subtractive lights
|
|
||||||
//
|
|
||||||
for(int i=lightRange.y; i<lightRange.z; i+=4)
|
|
||||||
{
|
|
||||||
vec4 lightpos = lights[i];
|
|
||||||
vec4 lightcolor = lights[i+1];
|
|
||||||
vec4 lightspot1 = lights[i+2];
|
|
||||||
vec4 lightspot2 = lights[i+3];
|
|
||||||
|
|
||||||
vec3 L = normalize(lightpos.xyz - worldpos);
|
|
||||||
vec3 H = normalize(V + L);
|
|
||||||
|
|
||||||
float attenuation = linearDistanceAttenuation(lightpos);
|
|
||||||
if (lightspot1.w == 1.0)
|
|
||||||
attenuation *= spotLightAttenuation(lightpos, lightspot1.xyz, lightspot2.x, lightspot2.y);
|
|
||||||
if (lightcolor.a < 0.0)
|
|
||||||
attenuation *= clamp(dot(N, L), 0.0, 1.0); // Sign bit is the attenuated light flag
|
|
||||||
|
|
||||||
if (attenuation > 0.0)
|
|
||||||
{
|
|
||||||
attenuation *= shadowAttenuation(lightpos, lightcolor.a);
|
|
||||||
|
|
||||||
vec3 radiance = lightcolor.rgb * attenuation;
|
|
||||||
|
|
||||||
// cook-torrance brdf
|
|
||||||
float NDF = DistributionGGX(N, H, roughness);
|
|
||||||
float G = GeometrySmith(N, V, L, roughness);
|
|
||||||
vec3 F = fresnelSchlick(clamp(dot(H, V), 0.0, 1.0), F0);
|
|
||||||
|
|
||||||
vec3 kS = F;
|
|
||||||
vec3 kD = (vec3(1.0) - kS) * (1.0 - metallic);
|
|
||||||
|
|
||||||
vec3 nominator = NDF * G * F;
|
|
||||||
float denominator = 4.0 * clamp(dot(N, V), 0.0, 1.0) * clamp(dot(N, L), 0.0, 1.0);
|
|
||||||
vec3 specular = nominator / max(denominator, 0.001);
|
|
||||||
|
|
||||||
Lo -= (kD * albedo / PI + specular) * radiance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pretend we sampled the sector light level from an irradiance map
|
|
||||||
|
|
||||||
vec3 F = fresnelSchlickRoughness(clamp(dot(N, V), 0.0, 1.0), F0, roughness);
|
|
||||||
|
|
||||||
vec3 kS = F;
|
|
||||||
vec3 kD = 1.0 - kS;
|
|
||||||
|
|
||||||
vec3 irradiance = ambientLight; // texture(irradianceMap, N).rgb
|
|
||||||
vec3 diffuse = irradiance * albedo;
|
|
||||||
|
|
||||||
//kD *= 1.0 - metallic;
|
|
||||||
//const float MAX_REFLECTION_LOD = 4.0;
|
|
||||||
//vec3 prefilteredColor = textureLod(prefilterMap, R, roughness * MAX_REFLECTION_LOD).rgb;
|
|
||||||
//vec2 envBRDF = texture(brdfLUT, vec2(clamp(dot(N, V), 0.0, 1.0), roughness)).rg;
|
|
||||||
//vec3 specular = prefilteredColor * (F * envBRDF.x + envBRDF.y);
|
|
||||||
|
|
||||||
//vec3 ambient = (kD * diffuse + specular) * ao;
|
|
||||||
vec3 ambient = (kD * diffuse) * ao;
|
|
||||||
|
|
||||||
vec3 color = max(ambient + Lo, vec3(0.0));
|
|
||||||
|
|
||||||
// Tonemap (reinhard) and apply sRGB gamma
|
|
||||||
//color = color / (color + vec3(1.0));
|
|
||||||
return pow(color, vec3(1.0 / 2.2));
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
|
|
||||||
vec2 lightAttenuation(int i, vec3 normal, vec3 viewdir, float lightcolorA)
|
|
||||||
{
|
|
||||||
vec4 lightpos = lights[i];
|
|
||||||
vec4 lightspot1 = lights[i+2];
|
|
||||||
vec4 lightspot2 = lights[i+3];
|
|
||||||
|
|
||||||
float lightdistance = distance(lightpos.xyz, pixelpos.xyz);
|
|
||||||
if (lightpos.w < lightdistance)
|
|
||||||
return vec2(0.0); // Early out lights touching surface but not this fragment
|
|
||||||
|
|
||||||
float attenuation = clamp((lightpos.w - lightdistance) / lightpos.w, 0.0, 1.0);
|
|
||||||
|
|
||||||
if (lightspot1.w == 1.0)
|
|
||||||
attenuation *= spotLightAttenuation(lightpos, lightspot1.xyz, lightspot2.x, lightspot2.y);
|
|
||||||
|
|
||||||
vec3 lightdir = normalize(lightpos.xyz - pixelpos.xyz);
|
|
||||||
|
|
||||||
if (lightcolorA < 0.0) // Sign bit is the attenuated light flag
|
|
||||||
attenuation *= clamp(dot(normal, lightdir), 0.0, 1.0);
|
|
||||||
|
|
||||||
if (attenuation > 0.0) // Skip shadow map test if possible
|
|
||||||
attenuation *= shadowAttenuation(lightpos, lightcolorA);
|
|
||||||
|
|
||||||
if (attenuation <= 0.0)
|
|
||||||
return vec2(0.0);
|
|
||||||
|
|
||||||
float glossiness = uSpecularMaterial.x;
|
|
||||||
float specularLevel = uSpecularMaterial.y;
|
|
||||||
|
|
||||||
vec3 halfdir = normalize(viewdir + lightdir);
|
|
||||||
float specAngle = clamp(dot(halfdir, normal), 0.0, 1.0);
|
|
||||||
float phExp = glossiness * 4.0;
|
|
||||||
return vec2(attenuation, attenuation * specularLevel * pow(specAngle, phExp));
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 ProcessMaterialLight(Material material, vec3 color)
|
|
||||||
{
|
|
||||||
vec4 dynlight = uDynLightColor;
|
|
||||||
vec4 specular = vec4(0.0, 0.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
vec3 normal = material.Normal;
|
|
||||||
vec3 viewdir = normalize(uCameraPos.xyz - pixelpos.xyz);
|
|
||||||
|
|
||||||
if (uLightIndex >= 0)
|
|
||||||
{
|
|
||||||
ivec4 lightRange = ivec4(lights[uLightIndex]) + ivec4(uLightIndex + 1);
|
|
||||||
if (lightRange.z > lightRange.x)
|
|
||||||
{
|
|
||||||
// modulated lights
|
|
||||||
for(int i=lightRange.x; i<lightRange.y; i+=4)
|
|
||||||
{
|
|
||||||
vec4 lightcolor = lights[i+1];
|
|
||||||
vec2 attenuation = lightAttenuation(i, normal, viewdir, lightcolor.a);
|
|
||||||
dynlight.rgb += lightcolor.rgb * attenuation.x;
|
|
||||||
specular.rgb += lightcolor.rgb * attenuation.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// subtractive lights
|
|
||||||
for(int i=lightRange.y; i<lightRange.z; i+=4)
|
|
||||||
{
|
|
||||||
vec4 lightcolor = lights[i+1];
|
|
||||||
vec2 attenuation = lightAttenuation(i, normal, viewdir, lightcolor.a);
|
|
||||||
dynlight.rgb -= lightcolor.rgb * attenuation.x;
|
|
||||||
specular.rgb -= lightcolor.rgb * attenuation.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynlight.rgb = clamp(color + desaturate(dynlight).rgb, 0.0, 1.4);
|
|
||||||
specular.rgb = clamp(desaturate(specular).rgb, 0.0, 1.4);
|
|
||||||
|
|
||||||
vec3 frag = material.Base.rgb * dynlight.rgb + material.Specular * specular.rgb;
|
|
||||||
|
|
||||||
if (uLightIndex >= 0)
|
|
||||||
{
|
|
||||||
ivec4 lightRange = ivec4(lights[uLightIndex]) + ivec4(uLightIndex + 1);
|
|
||||||
if (lightRange.w > lightRange.z)
|
|
||||||
{
|
|
||||||
vec4 addlight = vec4(0.0,0.0,0.0,0.0);
|
|
||||||
|
|
||||||
// additive lights
|
|
||||||
for(int i=lightRange.z; i<lightRange.w; i+=4)
|
|
||||||
{
|
|
||||||
vec4 lightcolor = lights[i+1];
|
|
||||||
vec2 attenuation = lightAttenuation(i, normal, viewdir, lightcolor.a);
|
|
||||||
addlight.rgb += lightcolor.rgb * attenuation.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
frag = clamp(frag + desaturate(addlight).rgb, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return frag;
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D Bloom;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
FragColor = vec4(texture(Bloom, TexCoord).rgb, 0.0);
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
layout(binding=0) uniform sampler2D SceneTexture;
|
|
||||||
layout(binding=1) uniform sampler2D ExposureTexture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
float exposureAdjustment = texture(ExposureTexture, vec2(0.5)).x;
|
|
||||||
vec4 color = texture(SceneTexture, Offset + TexCoord * Scale);
|
|
||||||
FragColor = max(vec4((color.rgb + vec3(0.001)) * exposureAdjustment - 1.0, 1.0), vec4(0));
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D SourceTexture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
#if defined(BLUR_HORIZONTAL)
|
|
||||||
FragColor =
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2( 0, 0)) * SampleWeights0 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2( 1, 0)) * SampleWeights1 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(-1, 0)) * SampleWeights2 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2( 2, 0)) * SampleWeights3 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(-2, 0)) * SampleWeights4 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2( 3, 0)) * SampleWeights5 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(-3, 0)) * SampleWeights6;
|
|
||||||
#else
|
|
||||||
FragColor =
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(0, 0)) * SampleWeights0 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(0, 1)) * SampleWeights1 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(0,-1)) * SampleWeights2 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(0, 2)) * SampleWeights3 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(0,-2)) * SampleWeights4 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(0, 3)) * SampleWeights5 +
|
|
||||||
textureOffset(SourceTexture, TexCoord, ivec2(0,-3)) * SampleWeights6;
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
layout(binding=0) uniform sampler2D SceneTexture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 frag = texture(SceneTexture, TexCoord);
|
|
||||||
frag.rgb = clamp(pow(frag.rgb, vec3(uFixedColormapStart.a)), 0.0, 1.0);
|
|
||||||
if (uFixedColormapRange.a == 0.0)
|
|
||||||
{
|
|
||||||
float gray = (frag.r * 0.3 + frag.g * 0.56 + frag.b * 0.14);
|
|
||||||
vec4 cm = uFixedColormapStart + gray * uFixedColormapRange;
|
|
||||||
frag.rgb = clamp(cm.rgb, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
FragColor = frag;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D AODepthTexture;
|
|
||||||
|
|
||||||
#define KERNEL_RADIUS 3.0
|
|
||||||
|
|
||||||
void AddSample(vec2 blurSample, float r, float centerDepth, inout float totalAO, inout float totalW)
|
|
||||||
{
|
|
||||||
const float blurSigma = KERNEL_RADIUS * 0.5;
|
|
||||||
const float blurFalloff = 1.0 / (2.0 * blurSigma * blurSigma);
|
|
||||||
|
|
||||||
float ao = blurSample.x;
|
|
||||||
float z = blurSample.y;
|
|
||||||
|
|
||||||
float deltaZ = (z - centerDepth) * BlurSharpness;
|
|
||||||
float w = exp2(-r * r * blurFalloff - deltaZ * deltaZ);
|
|
||||||
|
|
||||||
totalAO += w * ao;
|
|
||||||
totalW += w;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec2 centerSample = textureOffset(AODepthTexture, TexCoord, ivec2( 0, 0)).xy;
|
|
||||||
float centerDepth = centerSample.y;
|
|
||||||
float totalAO = centerSample.x;
|
|
||||||
float totalW = 1.0;
|
|
||||||
|
|
||||||
#if defined(BLUR_HORIZONTAL)
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(-3, 0)).xy, 3.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(-2, 0)).xy, 2.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(-1, 0)).xy, 1.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2( 1, 0)).xy, 1.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2( 2, 0)).xy, 2.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2( 3, 0)).xy, 3.0, centerDepth, totalAO, totalW);
|
|
||||||
#else
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(0, -3)).xy, 3.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(0, -2)).xy, 2.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(0, -1)).xy, 1.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(0, 1)).xy, 1.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(0, 2)).xy, 2.0, centerDepth, totalAO, totalW);
|
|
||||||
AddSample(textureOffset(AODepthTexture, TexCoord, ivec2(0, 3)).xy, 3.0, centerDepth, totalAO, totalW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float fragAO = totalAO / totalW;
|
|
||||||
|
|
||||||
#if defined(BLUR_HORIZONTAL)
|
|
||||||
FragColor = vec4(fragAO, centerDepth, 0.0, 1.0);
|
|
||||||
#else
|
|
||||||
FragColor = vec4(pow(clamp(fragAO, 0.0, 1.0), PowExponent), 0.0, 0.0, 1.0);
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
layout(binding=0) uniform sampler2D ExposureTexture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
#if __VERSION__ < 400
|
|
||||||
ivec2 size = textureSize(ExposureTexture, 0);
|
|
||||||
ivec2 tl = max(ivec2(TexCoord * vec2(size) - 0.5), ivec2(0));
|
|
||||||
ivec2 br = min(tl + ivec2(1), size - ivec2(1));
|
|
||||||
vec4 values = vec4(
|
|
||||||
texelFetch(ExposureTexture, tl, 0).x,
|
|
||||||
texelFetch(ExposureTexture, ivec2(tl.x, br.y), 0).x,
|
|
||||||
texelFetch(ExposureTexture, ivec2(br.x, tl.y), 0).x,
|
|
||||||
texelFetch(ExposureTexture, br, 0).x);
|
|
||||||
#else
|
|
||||||
vec4 values = textureGather(ExposureTexture, TexCoord);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FragColor = vec4((values.x + values.y + values.z + values.w) * 0.25, 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D ExposureTexture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
float light = texture(ExposureTexture, TexCoord).x;
|
|
||||||
float exposureAdjustment = 1.0 / max(ExposureBase + light * ExposureScale, ExposureMin);
|
|
||||||
FragColor = vec4(exposureAdjustment, 0.0, 0.0, ExposureSpeed);
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D SceneTexture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 color = texture(SceneTexture, Offset + TexCoord * Scale);
|
|
||||||
FragColor = vec4(max(max(color.r, color.g), color.b), 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
|
@ -1,613 +0,0 @@
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
// File: es3-kepler\FXAA/FXAA3_11.h
|
|
||||||
// SDK Version: v3.00
|
|
||||||
// Email: gameworks@nvidia.com
|
|
||||||
// Site: http://developer.nvidia.com/
|
|
||||||
//
|
|
||||||
// Copyright (c) 2014-2015, NVIDIA CORPORATION. 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.
|
|
||||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived
|
|
||||||
// from this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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.
|
|
||||||
//
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D InputTexture;
|
|
||||||
|
|
||||||
#ifdef FXAA_LUMA_PASS
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec3 tex = texture(InputTexture, TexCoord).rgb;
|
|
||||||
vec3 luma = vec3(0.299, 0.587, 0.114);
|
|
||||||
FragColor = vec4(tex, dot(tex, luma));
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // FXAA itself
|
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
// NVIDIA FXAA 3.11 by TIMOTHY LOTTES
|
|
||||||
//============================================================================
|
|
||||||
|
|
||||||
#define FXAA_DISCARD 0
|
|
||||||
|
|
||||||
#define FXAA_GREEN_AS_LUMA 0
|
|
||||||
|
|
||||||
#define FxaaBool bool
|
|
||||||
#define FxaaDiscard discard
|
|
||||||
#define FxaaFloat float
|
|
||||||
#define FxaaFloat2 vec2
|
|
||||||
#define FxaaFloat3 vec3
|
|
||||||
#define FxaaFloat4 vec4
|
|
||||||
#define FxaaHalf float
|
|
||||||
#define FxaaHalf2 vec2
|
|
||||||
#define FxaaHalf3 vec3
|
|
||||||
#define FxaaHalf4 vec4
|
|
||||||
#define FxaaInt2 ivec2
|
|
||||||
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
|
||||||
#define FxaaTex sampler2D
|
|
||||||
|
|
||||||
#define FxaaTexTop(t, p) textureLod(t, p, 0.0)
|
|
||||||
#define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
|
|
||||||
|
|
||||||
#if (FXAA_GATHER4_ALPHA == 1)
|
|
||||||
#define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
|
|
||||||
#define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
|
|
||||||
#define FxaaTexGreen4(t, p) textureGather(t, p, 1)
|
|
||||||
#define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
|
||||||
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }
|
|
||||||
#else
|
|
||||||
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (FXAA_QUALITY__PRESET == 10)
|
|
||||||
#define FXAA_QUALITY__PS 3
|
|
||||||
#define FXAA_QUALITY__P0 1.5
|
|
||||||
#define FXAA_QUALITY__P1 3.0
|
|
||||||
#define FXAA_QUALITY__P2 12.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 11)
|
|
||||||
#define FXAA_QUALITY__PS 4
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 3.0
|
|
||||||
#define FXAA_QUALITY__P3 12.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 12)
|
|
||||||
#define FXAA_QUALITY__PS 5
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 4.0
|
|
||||||
#define FXAA_QUALITY__P4 12.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 13)
|
|
||||||
#define FXAA_QUALITY__PS 6
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 4.0
|
|
||||||
#define FXAA_QUALITY__P5 12.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 14)
|
|
||||||
#define FXAA_QUALITY__PS 7
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 4.0
|
|
||||||
#define FXAA_QUALITY__P6 12.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 15)
|
|
||||||
#define FXAA_QUALITY__PS 8
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 2.0
|
|
||||||
#define FXAA_QUALITY__P6 4.0
|
|
||||||
#define FXAA_QUALITY__P7 12.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 20)
|
|
||||||
#define FXAA_QUALITY__PS 3
|
|
||||||
#define FXAA_QUALITY__P0 1.5
|
|
||||||
#define FXAA_QUALITY__P1 2.0
|
|
||||||
#define FXAA_QUALITY__P2 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 21)
|
|
||||||
#define FXAA_QUALITY__PS 4
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 22)
|
|
||||||
#define FXAA_QUALITY__PS 5
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 23)
|
|
||||||
#define FXAA_QUALITY__PS 6
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 24)
|
|
||||||
#define FXAA_QUALITY__PS 7
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 3.0
|
|
||||||
#define FXAA_QUALITY__P6 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 25)
|
|
||||||
#define FXAA_QUALITY__PS 8
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 2.0
|
|
||||||
#define FXAA_QUALITY__P6 4.0
|
|
||||||
#define FXAA_QUALITY__P7 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 26)
|
|
||||||
#define FXAA_QUALITY__PS 9
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 2.0
|
|
||||||
#define FXAA_QUALITY__P6 2.0
|
|
||||||
#define FXAA_QUALITY__P7 4.0
|
|
||||||
#define FXAA_QUALITY__P8 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 27)
|
|
||||||
#define FXAA_QUALITY__PS 10
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 2.0
|
|
||||||
#define FXAA_QUALITY__P6 2.0
|
|
||||||
#define FXAA_QUALITY__P7 2.0
|
|
||||||
#define FXAA_QUALITY__P8 4.0
|
|
||||||
#define FXAA_QUALITY__P9 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 28)
|
|
||||||
#define FXAA_QUALITY__PS 11
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 2.0
|
|
||||||
#define FXAA_QUALITY__P6 2.0
|
|
||||||
#define FXAA_QUALITY__P7 2.0
|
|
||||||
#define FXAA_QUALITY__P8 2.0
|
|
||||||
#define FXAA_QUALITY__P9 4.0
|
|
||||||
#define FXAA_QUALITY__P10 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 29)
|
|
||||||
#define FXAA_QUALITY__PS 12
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.5
|
|
||||||
#define FXAA_QUALITY__P2 2.0
|
|
||||||
#define FXAA_QUALITY__P3 2.0
|
|
||||||
#define FXAA_QUALITY__P4 2.0
|
|
||||||
#define FXAA_QUALITY__P5 2.0
|
|
||||||
#define FXAA_QUALITY__P6 2.0
|
|
||||||
#define FXAA_QUALITY__P7 2.0
|
|
||||||
#define FXAA_QUALITY__P8 2.0
|
|
||||||
#define FXAA_QUALITY__P9 2.0
|
|
||||||
#define FXAA_QUALITY__P10 4.0
|
|
||||||
#define FXAA_QUALITY__P11 8.0
|
|
||||||
#elif (FXAA_QUALITY__PRESET == 39)
|
|
||||||
#define FXAA_QUALITY__PS 12
|
|
||||||
#define FXAA_QUALITY__P0 1.0
|
|
||||||
#define FXAA_QUALITY__P1 1.0
|
|
||||||
#define FXAA_QUALITY__P2 1.0
|
|
||||||
#define FXAA_QUALITY__P3 1.0
|
|
||||||
#define FXAA_QUALITY__P4 1.0
|
|
||||||
#define FXAA_QUALITY__P5 1.5
|
|
||||||
#define FXAA_QUALITY__P6 2.0
|
|
||||||
#define FXAA_QUALITY__P7 2.0
|
|
||||||
#define FXAA_QUALITY__P8 2.0
|
|
||||||
#define FXAA_QUALITY__P9 2.0
|
|
||||||
#define FXAA_QUALITY__P10 4.0
|
|
||||||
#define FXAA_QUALITY__P11 8.0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FxaaFloat4 FxaaPixelShader(FxaaFloat2 pos, FxaaTex tex, FxaaFloat2 fxaaQualityRcpFrame,
|
|
||||||
FxaaFloat fxaaQualitySubpix, FxaaFloat fxaaQualityEdgeThreshold, FxaaFloat fxaaQualityEdgeThresholdMin)
|
|
||||||
{
|
|
||||||
FxaaFloat2 posM;
|
|
||||||
posM.x = pos.x;
|
|
||||||
posM.y = pos.y;
|
|
||||||
#if (FXAA_GATHER4_ALPHA == 1)
|
|
||||||
#if (FXAA_DISCARD == 0)
|
|
||||||
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
|
|
||||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
|
||||||
#define lumaM rgbyM.w
|
|
||||||
#else
|
|
||||||
#define lumaM rgbyM.y
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
|
||||||
FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);
|
|
||||||
FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));
|
|
||||||
#else
|
|
||||||
FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);
|
|
||||||
FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));
|
|
||||||
#endif
|
|
||||||
#if (FXAA_DISCARD == 1)
|
|
||||||
#define lumaM luma4A.w
|
|
||||||
#endif
|
|
||||||
#define lumaE luma4A.z
|
|
||||||
#define lumaS luma4A.x
|
|
||||||
#define lumaSE luma4A.y
|
|
||||||
#define lumaNW luma4B.w
|
|
||||||
#define lumaN luma4B.z
|
|
||||||
#define lumaW luma4B.x
|
|
||||||
#else
|
|
||||||
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
|
|
||||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
|
||||||
#define lumaM rgbyM.w
|
|
||||||
#else
|
|
||||||
#define lumaM rgbyM.y
|
|
||||||
#endif
|
|
||||||
FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
|
|
||||||
FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
|
|
||||||
FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
|
|
||||||
FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat maxSM = max(lumaS, lumaM);
|
|
||||||
FxaaFloat minSM = min(lumaS, lumaM);
|
|
||||||
FxaaFloat maxESM = max(lumaE, maxSM);
|
|
||||||
FxaaFloat minESM = min(lumaE, minSM);
|
|
||||||
FxaaFloat maxWN = max(lumaN, lumaW);
|
|
||||||
FxaaFloat minWN = min(lumaN, lumaW);
|
|
||||||
FxaaFloat rangeMax = max(maxWN, maxESM);
|
|
||||||
FxaaFloat rangeMin = min(minWN, minESM);
|
|
||||||
FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
|
|
||||||
FxaaFloat range = rangeMax - rangeMin;
|
|
||||||
FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
|
|
||||||
FxaaBool earlyExit = range < rangeMaxClamped;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
if(earlyExit)
|
|
||||||
#if (FXAA_DISCARD == 1)
|
|
||||||
FxaaDiscard;
|
|
||||||
#else
|
|
||||||
return rgbyM;
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_GATHER4_ALPHA == 0)
|
|
||||||
FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
|
|
||||||
FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
|
|
||||||
FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
|
|
||||||
FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
|
|
||||||
#else
|
|
||||||
FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));
|
|
||||||
FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat lumaNS = lumaN + lumaS;
|
|
||||||
FxaaFloat lumaWE = lumaW + lumaE;
|
|
||||||
FxaaFloat subpixRcpRange = 1.0/range;
|
|
||||||
FxaaFloat subpixNSWE = lumaNS + lumaWE;
|
|
||||||
FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
|
|
||||||
FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat lumaNESE = lumaNE + lumaSE;
|
|
||||||
FxaaFloat lumaNWNE = lumaNW + lumaNE;
|
|
||||||
FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
|
|
||||||
FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat lumaNWSW = lumaNW + lumaSW;
|
|
||||||
FxaaFloat lumaSWSE = lumaSW + lumaSE;
|
|
||||||
FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
|
|
||||||
FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
|
|
||||||
FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
|
|
||||||
FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
|
|
||||||
FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
|
|
||||||
FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
|
|
||||||
FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
|
|
||||||
FxaaBool horzSpan = edgeHorz >= edgeVert;
|
|
||||||
FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
if(!horzSpan) lumaN = lumaW;
|
|
||||||
if(!horzSpan) lumaS = lumaE;
|
|
||||||
if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
|
|
||||||
FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat gradientN = lumaN - lumaM;
|
|
||||||
FxaaFloat gradientS = lumaS - lumaM;
|
|
||||||
FxaaFloat lumaNN = lumaN + lumaM;
|
|
||||||
FxaaFloat lumaSS = lumaS + lumaM;
|
|
||||||
FxaaBool pairN = abs(gradientN) >= abs(gradientS);
|
|
||||||
FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
|
|
||||||
if(pairN) lengthSign = -lengthSign;
|
|
||||||
FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat2 posB;
|
|
||||||
posB.x = posM.x;
|
|
||||||
posB.y = posM.y;
|
|
||||||
FxaaFloat2 offNP;
|
|
||||||
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
|
|
||||||
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
|
|
||||||
if(!horzSpan) posB.x += lengthSign * 0.5;
|
|
||||||
if( horzSpan) posB.y += lengthSign * 0.5;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat2 posN;
|
|
||||||
posN.x = posB.x - offNP.x * FXAA_QUALITY__P0;
|
|
||||||
posN.y = posB.y - offNP.y * FXAA_QUALITY__P0;
|
|
||||||
FxaaFloat2 posP;
|
|
||||||
posP.x = posB.x + offNP.x * FXAA_QUALITY__P0;
|
|
||||||
posP.y = posB.y + offNP.y * FXAA_QUALITY__P0;
|
|
||||||
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
|
|
||||||
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
|
|
||||||
FxaaFloat subpixE = subpixC * subpixC;
|
|
||||||
FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
if(!pairN) lumaNN = lumaSS;
|
|
||||||
FxaaFloat gradientScaled = gradient * 1.0/4.0;
|
|
||||||
FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
|
|
||||||
FxaaFloat subpixF = subpixD * subpixE;
|
|
||||||
FxaaBool lumaMLTZero = lumaMM < 0.0;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
lumaEndN -= lumaNN * 0.5;
|
|
||||||
lumaEndP -= lumaNN * 0.5;
|
|
||||||
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1;
|
|
||||||
FxaaBool doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 3)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 4)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 5)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 6)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 7)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 8)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 9)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 10)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 11)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
#if (FXAA_QUALITY__PS > 12)
|
|
||||||
if(doneNP) {
|
|
||||||
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
||||||
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
||||||
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
||||||
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
||||||
doneN = abs(lumaEndN) >= gradientScaled;
|
|
||||||
doneP = abs(lumaEndP) >= gradientScaled;
|
|
||||||
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12;
|
|
||||||
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12;
|
|
||||||
doneNP = (!doneN) || (!doneP);
|
|
||||||
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12;
|
|
||||||
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
}
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat dstN = posM.x - posN.x;
|
|
||||||
FxaaFloat dstP = posP.x - posM.x;
|
|
||||||
if(!horzSpan) dstN = posM.y - posN.y;
|
|
||||||
if(!horzSpan) dstP = posP.y - posM.y;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
|
|
||||||
FxaaFloat spanLength = (dstP + dstN);
|
|
||||||
FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
|
|
||||||
FxaaFloat spanLengthRcp = 1.0/spanLength;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaBool directionN = dstN < dstP;
|
|
||||||
FxaaFloat dst = min(dstN, dstP);
|
|
||||||
FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
|
|
||||||
FxaaFloat subpixG = subpixF * subpixF;
|
|
||||||
FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
|
|
||||||
FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
|
|
||||||
FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
|
|
||||||
if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
|
|
||||||
if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
|
|
||||||
#if (FXAA_DISCARD == 1)
|
|
||||||
return FxaaTexTop(tex, posM);
|
|
||||||
#else
|
|
||||||
return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
FragColor = FxaaPixelShader(TexCoord, InputTexture, ReciprocalResolution, 0.75f, 0.166f, 0.0833f);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // FXAA_LUMA_PASS
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*
|
|
||||||
Original Lens Distortion Algorithm from SSontech
|
|
||||||
http://www.ssontech.com/content/lensalg.htm
|
|
||||||
|
|
||||||
If (u,v) are the coordinates of a feature in the undistorted perfect
|
|
||||||
image plane, then (u', v') are the coordinates of the feature on the
|
|
||||||
distorted image plate, ie the scanned or captured image from the
|
|
||||||
camera. The distortion occurs radially away from the image center,
|
|
||||||
with correction for the image aspect ratio (image_aspect = physical
|
|
||||||
image width/height), as follows:
|
|
||||||
|
|
||||||
r2 = image_aspect*image_aspect*u*u + v*v
|
|
||||||
f = 1 + r2*(k + kcube*sqrt(r2))
|
|
||||||
u' = f*u
|
|
||||||
v' = f*v
|
|
||||||
|
|
||||||
The constant k is the distortion coefficient that appears on the lens
|
|
||||||
panel and through Sizzle. It is generally a small positive or negative
|
|
||||||
number under 1%. The constant kcube is the cubic distortion value found
|
|
||||||
on the image preprocessor's lens panel: it can be used to undistort or
|
|
||||||
redistort images, but it does not affect or get computed by the solver.
|
|
||||||
When no cubic distortion is needed, neither is the square root, saving
|
|
||||||
time.
|
|
||||||
|
|
||||||
Chromatic Aberration example,
|
|
||||||
using red distord channel with green and blue undistord channel:
|
|
||||||
|
|
||||||
k = vec3(-0.15, 0.0, 0.0);
|
|
||||||
kcube = vec3(0.15, 0.0, 0.0);
|
|
||||||
*/
|
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D InputTexture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec2 position = (TexCoord - vec2(0.5));
|
|
||||||
|
|
||||||
vec2 p = vec2(position.x * Aspect, position.y);
|
|
||||||
float r2 = dot(p, p);
|
|
||||||
vec3 f = vec3(1.0) + r2 * (k.rgb + kcube.rgb * sqrt(r2));
|
|
||||||
|
|
||||||
vec3 x = f * position.x * Scale + 0.5;
|
|
||||||
vec3 y = f * position.y * Scale + 0.5;
|
|
||||||
|
|
||||||
vec3 c;
|
|
||||||
c.r = texture(InputTexture, vec2(x.r, y.r)).r;
|
|
||||||
c.g = texture(InputTexture, vec2(x.g, y.g)).g;
|
|
||||||
c.b = texture(InputTexture, vec2(x.b, y.b)).b;
|
|
||||||
|
|
||||||
FragColor = vec4(c, 1.0);
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
layout(binding=0) uniform sampler2DMS DepthTexture;
|
|
||||||
layout(binding=1) uniform sampler2DMS ColorTexture;
|
|
||||||
#else
|
|
||||||
layout(binding=0) uniform sampler2D DepthTexture;
|
|
||||||
layout(binding=1) uniform sampler2D ColorTexture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float normalizeDepth(float depth)
|
|
||||||
{
|
|
||||||
float normalizedDepth = clamp(InverseDepthRangeA * depth + InverseDepthRangeB, 0.0, 1.0);
|
|
||||||
return 1.0 / (normalizedDepth * LinearizeDepthA + LinearizeDepthB);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec2 uv = Offset + TexCoord * Scale;
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
ivec2 texSize = textureSize(DepthTexture);
|
|
||||||
#else
|
|
||||||
ivec2 texSize = textureSize(DepthTexture, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ivec2 ipos = ivec2(max(uv * vec2(texSize), vec2(0.0)));
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
float depth = normalizeDepth(texelFetch(ColorTexture, ipos, SampleIndex).a != 0.0 ? texelFetch(DepthTexture, ipos, SampleIndex).x : 1.0);
|
|
||||||
#else
|
|
||||||
float depth = normalizeDepth(texelFetch(ColorTexture, ipos, 0).a != 0.0 ? texelFetch(DepthTexture, ipos, 0).x : 1.0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FragColor = vec4(depth, 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D LeftEyeTexture;
|
|
||||||
layout(binding=1) uniform sampler2D RightEyeTexture;
|
|
||||||
|
|
||||||
vec4 ApplyGamma(vec4 c)
|
|
||||||
{
|
|
||||||
vec3 val = c.rgb * Contrast - (Contrast - 1.0) * 0.5;
|
|
||||||
val += Brightness * 0.5;
|
|
||||||
val = pow(max(val, vec3(0.0)), vec3(InvGamma));
|
|
||||||
return vec4(val, c.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
int thisVerticalPixel = int(gl_FragCoord.y); // Bottom row is typically the right eye, when WindowHeight is even
|
|
||||||
int thisHorizontalPixel = int(gl_FragCoord.x); // column
|
|
||||||
bool isLeftEye = (thisVerticalPixel // because we want to alternate eye view on each row
|
|
||||||
+ thisHorizontalPixel // and each column
|
|
||||||
+ WindowPositionParity // because the window might not be aligned to the screen
|
|
||||||
) % 2 == 0;
|
|
||||||
vec4 inputColor;
|
|
||||||
if (isLeftEye) {
|
|
||||||
inputColor = texture(LeftEyeTexture, UVOffset + TexCoord * UVScale);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// inputColor = vec4(0, 1, 0, 1);
|
|
||||||
inputColor = texture(RightEyeTexture, UVOffset + TexCoord * UVScale);
|
|
||||||
}
|
|
||||||
FragColor = ApplyGamma(inputColor);
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D LeftEyeTexture;
|
|
||||||
layout(binding=1) uniform sampler2D RightEyeTexture;
|
|
||||||
|
|
||||||
vec4 ApplyGamma(vec4 c)
|
|
||||||
{
|
|
||||||
vec3 val = c.rgb * Contrast - (Contrast - 1.0) * 0.5;
|
|
||||||
val += Brightness * 0.5;
|
|
||||||
val = pow(max(val, vec3(0.0)), vec3(InvGamma));
|
|
||||||
return vec4(val, c.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
int thisHorizontalPixel = int(gl_FragCoord.x); // zero-based column index from left
|
|
||||||
bool isLeftEye = (thisHorizontalPixel // because we want to alternate eye view on each column
|
|
||||||
+ WindowPositionParity // because the window might not be aligned to the screen
|
|
||||||
) % 2 == 0;
|
|
||||||
vec4 inputColor;
|
|
||||||
if (isLeftEye) {
|
|
||||||
inputColor = texture(LeftEyeTexture, UVOffset + TexCoord * UVScale);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// inputColor = vec4(0, 1, 0, 1);
|
|
||||||
inputColor = texture(RightEyeTexture, UVOffset + TexCoord * UVScale);
|
|
||||||
}
|
|
||||||
FragColor = ApplyGamma(inputColor);
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D LeftEyeTexture;
|
|
||||||
layout(binding=1) uniform sampler2D RightEyeTexture;
|
|
||||||
|
|
||||||
vec4 ApplyGamma(vec4 c)
|
|
||||||
{
|
|
||||||
vec3 val = c.rgb * Contrast - (Contrast - 1.0) * 0.5;
|
|
||||||
val += Brightness * 0.5;
|
|
||||||
val = pow(max(val, vec3(0.0)), vec3(InvGamma));
|
|
||||||
return vec4(val, c.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
int thisVerticalPixel = int(gl_FragCoord.y); // Bottom row is typically the right eye, when WindowHeight is even
|
|
||||||
bool isLeftEye = (thisVerticalPixel // because we want to alternate eye view on each row
|
|
||||||
+ WindowPositionParity // because the window might not be aligned to the screen
|
|
||||||
) % 2 == 0;
|
|
||||||
vec4 inputColor;
|
|
||||||
if (isLeftEye) {
|
|
||||||
inputColor = texture(LeftEyeTexture, UVOffset + TexCoord * UVScale);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// inputColor = vec4(0, 1, 0, 1);
|
|
||||||
inputColor = texture(RightEyeTexture, UVOffset + TexCoord * UVScale);
|
|
||||||
}
|
|
||||||
FragColor = ApplyGamma(inputColor);
|
|
||||||
}
|
|
|
@ -1,190 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
// A node in an AABB binary tree with lines stored in the leaf nodes
|
|
||||||
struct GPUNode
|
|
||||||
{
|
|
||||||
vec2 aabb_min; // Min xy values for the axis-aligned box containing the node and its subtree
|
|
||||||
vec2 aabb_max; // Max xy values
|
|
||||||
int left; // Left subnode index
|
|
||||||
int right; // Right subnode index
|
|
||||||
int line_index; // Line index if it is a leaf node, otherwise -1
|
|
||||||
int padding; // Unused - maintains 16 byte alignment
|
|
||||||
};
|
|
||||||
|
|
||||||
// 2D line segment, referenced by leaf nodes
|
|
||||||
struct GPULine
|
|
||||||
{
|
|
||||||
vec2 pos; // Line start position
|
|
||||||
vec2 delta; // Line end position - line start position
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 4) buffer LightNodes
|
|
||||||
{
|
|
||||||
GPUNode nodes[];
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 5) buffer LightLines
|
|
||||||
{
|
|
||||||
GPULine lines[];
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 6) buffer LightList
|
|
||||||
{
|
|
||||||
vec4 lights[];
|
|
||||||
};
|
|
||||||
|
|
||||||
// Overlap test between line segment and axis-aligned bounding box. Returns true if they overlap.
|
|
||||||
bool overlapRayAABB(vec2 ray_start2d, vec2 ray_end2d, vec2 aabb_min2d, vec2 aabb_max2d)
|
|
||||||
{
|
|
||||||
// To do: simplify test to use a 2D test
|
|
||||||
vec3 ray_start = vec3(ray_start2d, 0.0);
|
|
||||||
vec3 ray_end = vec3(ray_end2d, 0.0);
|
|
||||||
vec3 aabb_min = vec3(aabb_min2d, -1.0);
|
|
||||||
vec3 aabb_max = vec3(aabb_max2d, 1.0);
|
|
||||||
|
|
||||||
vec3 c = (ray_start + ray_end) * 0.5f;
|
|
||||||
vec3 w = ray_end - c;
|
|
||||||
vec3 h = (aabb_max - aabb_min) * 0.5f; // aabb.extents();
|
|
||||||
|
|
||||||
c -= (aabb_max + aabb_min) * 0.5f; // aabb.center();
|
|
||||||
|
|
||||||
vec3 v = abs(w);
|
|
||||||
|
|
||||||
if (abs(c.x) > v.x + h.x || abs(c.y) > v.y + h.y || abs(c.z) > v.z + h.z)
|
|
||||||
return false; // disjoint;
|
|
||||||
|
|
||||||
if (abs(c.y * w.z - c.z * w.y) > h.y * v.z + h.z * v.y ||
|
|
||||||
abs(c.x * w.z - c.z * w.x) > h.x * v.z + h.z * v.x ||
|
|
||||||
abs(c.x * w.y - c.y * w.x) > h.x * v.y + h.y * v.x)
|
|
||||||
return false; // disjoint;
|
|
||||||
|
|
||||||
return true; // overlap;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Intersection test between two line segments.
|
|
||||||
// Returns the intersection point as a value between 0-1 on the ray line segment. 1.0 if there was no hit.
|
|
||||||
float intersectRayLine(vec2 ray_start, vec2 ray_end, int line_index, vec2 raydelta, float rayd, float raydist2)
|
|
||||||
{
|
|
||||||
const float epsilon = 0.0000001;
|
|
||||||
GPULine line = lines[line_index];
|
|
||||||
|
|
||||||
vec2 raynormal = vec2(raydelta.y, -raydelta.x);
|
|
||||||
|
|
||||||
float den = dot(raynormal, line.delta);
|
|
||||||
if (abs(den) > epsilon)
|
|
||||||
{
|
|
||||||
float t_line = (rayd - dot(raynormal, line.pos)) / den;
|
|
||||||
if (t_line >= 0.0 && t_line <= 1.0)
|
|
||||||
{
|
|
||||||
vec2 linehitdelta = line.pos + line.delta * t_line - ray_start;
|
|
||||||
float t = dot(raydelta, linehitdelta) / raydist2;
|
|
||||||
return t > 0.0 ? t : 1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if an AABB tree node is a leaf node. Leaf nodes contains a line.
|
|
||||||
bool isLeaf(int node_index)
|
|
||||||
{
|
|
||||||
return nodes[node_index].line_index != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform ray intersection test between the ray line segment and all the lines in the AABB binary tree.
|
|
||||||
// Returns the intersection point as a value between 0-1 on the ray line segment. 1.0 if there was no hit.
|
|
||||||
float rayTest(vec2 ray_start, vec2 ray_end)
|
|
||||||
{
|
|
||||||
vec2 raydelta = ray_end - ray_start;
|
|
||||||
float raydist2 = dot(raydelta, raydelta);
|
|
||||||
vec2 raynormal = vec2(raydelta.y, -raydelta.x);
|
|
||||||
float rayd = dot(raynormal, ray_start);
|
|
||||||
if (raydist2 < 1.0)
|
|
||||||
return 1.0;
|
|
||||||
|
|
||||||
float t = 1.0;
|
|
||||||
|
|
||||||
// Walk the AABB binary tree searching for nodes touching the ray line segment's AABB box.
|
|
||||||
// When it reaches a leaf node, use a line segment intersection test to see if we got a hit.
|
|
||||||
|
|
||||||
int stack[32];
|
|
||||||
int stack_pos = 1;
|
|
||||||
stack[0] = NodesCount - 1;
|
|
||||||
while (stack_pos > 0)
|
|
||||||
{
|
|
||||||
int node_index = stack[stack_pos - 1];
|
|
||||||
|
|
||||||
if (!overlapRayAABB(ray_start, ray_end, nodes[node_index].aabb_min, nodes[node_index].aabb_max))
|
|
||||||
{
|
|
||||||
stack_pos--;
|
|
||||||
}
|
|
||||||
else if (isLeaf(node_index))
|
|
||||||
{
|
|
||||||
t = min(intersectRayLine(ray_start, ray_end, nodes[node_index].line_index, raydelta, rayd, raydist2), t);
|
|
||||||
stack_pos--;
|
|
||||||
}
|
|
||||||
else if (stack_pos == 32)
|
|
||||||
{
|
|
||||||
stack_pos--; // stack overflow
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stack[stack_pos - 1] = nodes[node_index].left;
|
|
||||||
stack[stack_pos] = nodes[node_index].right;
|
|
||||||
stack_pos++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
// Find the light that belongs to this texel in the shadowmap texture we output to:
|
|
||||||
|
|
||||||
int lightIndex = int(gl_FragCoord.y);
|
|
||||||
|
|
||||||
vec4 light = lights[lightIndex];
|
|
||||||
float radius = light.w;
|
|
||||||
vec2 lightpos = light.xy;
|
|
||||||
|
|
||||||
if (radius > 0.0)
|
|
||||||
{
|
|
||||||
// We found an active light. Calculate the ray direction for the texel.
|
|
||||||
//
|
|
||||||
// The texels are laid out so that there are four projections:
|
|
||||||
//
|
|
||||||
// * top-left to top-right
|
|
||||||
// * top-right to bottom-right
|
|
||||||
// * bottom-right to bottom-left
|
|
||||||
// * bottom-left to top-left
|
|
||||||
//
|
|
||||||
vec2 raydir;
|
|
||||||
float u = gl_FragCoord.x / ShadowmapQuality * 4.0;
|
|
||||||
switch (int(u))
|
|
||||||
{
|
|
||||||
case 0: raydir = vec2(u * 2.0 - 1.0, 1.0); break;
|
|
||||||
case 1: raydir = vec2(1.0, 1.0 - (u - 1.0) * 2.0); break;
|
|
||||||
case 2: raydir = vec2(1.0 - (u - 2.0) * 2.0, -1.0); break;
|
|
||||||
case 3: raydir = vec2(-1.0, (u - 3.0) * 2.0 - 1.0); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the position for the ray starting at the light position and travelling until light contribution is zero:
|
|
||||||
vec2 pixelpos = lightpos + raydir * radius;
|
|
||||||
|
|
||||||
// Check if we hit any line between the light and the end position:
|
|
||||||
float t = rayTest(lightpos, pixelpos);
|
|
||||||
|
|
||||||
// Calculate the square distance for the hit, if any:
|
|
||||||
vec2 delta = (pixelpos - lightpos) * t;
|
|
||||||
float dist2 = dot(delta, delta);
|
|
||||||
|
|
||||||
FragColor = vec4(dist2, 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,123 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D DepthTexture;
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
layout(binding=1) uniform sampler2DMS NormalTexture;
|
|
||||||
#else
|
|
||||||
layout(binding=1) uniform sampler2D NormalTexture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_RANDOM_TEXTURE)
|
|
||||||
layout(binding=2) uniform sampler2D RandomTexture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PI 3.14159265358979323846
|
|
||||||
|
|
||||||
// Calculate eye space position for the specified texture coordinate
|
|
||||||
vec3 FetchViewPos(vec2 uv)
|
|
||||||
{
|
|
||||||
float z = texture(DepthTexture, uv).x;
|
|
||||||
return vec3((UVToViewA * uv + UVToViewB) * z, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
vec3 SampleNormal(vec2 uv)
|
|
||||||
{
|
|
||||||
ivec2 texSize = textureSize(NormalTexture);
|
|
||||||
ivec2 ipos = ivec2(uv * vec2(texSize));
|
|
||||||
return texelFetch(NormalTexture, ipos, SampleIndex).xyz * 2.0 - 1.0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
vec3 SampleNormal(vec2 uv)
|
|
||||||
{
|
|
||||||
ivec2 texSize = textureSize(NormalTexture, 0);
|
|
||||||
ivec2 ipos = ivec2(uv * vec2(texSize));
|
|
||||||
return texelFetch(NormalTexture, ipos, 0).xyz * 2.0 - 1.0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Look up the eye space normal for the specified texture coordinate
|
|
||||||
vec3 FetchNormal(vec2 uv)
|
|
||||||
{
|
|
||||||
vec3 normal = SampleNormal(Offset + uv * Scale);
|
|
||||||
if (length(normal) > 0.1)
|
|
||||||
{
|
|
||||||
normal = normalize(normal);
|
|
||||||
normal.z = -normal.z;
|
|
||||||
return normal;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return vec3(0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute normalized 2D direction
|
|
||||||
vec2 RotateDirection(vec2 dir, vec2 cossin)
|
|
||||||
{
|
|
||||||
return vec2(dir.x * cossin.x - dir.y * cossin.y, dir.x * cossin.y + dir.y * cossin.x);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 GetJitter()
|
|
||||||
{
|
|
||||||
#if !defined(USE_RANDOM_TEXTURE)
|
|
||||||
return vec4(1,0,1,1);
|
|
||||||
//vec3 rand = noise3(TexCoord.x + TexCoord.y);
|
|
||||||
//float angle = 2.0 * PI * rand.x / NUM_DIRECTIONS;
|
|
||||||
//return vec4(cos(angle), sin(angle), rand.y, rand.z);
|
|
||||||
#else
|
|
||||||
return texture(RandomTexture, gl_FragCoord.xy / RANDOM_TEXTURE_WIDTH);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculates the ambient occlusion of a sample
|
|
||||||
float ComputeSampleAO(vec3 kernelPos, vec3 normal, vec3 samplePos)
|
|
||||||
{
|
|
||||||
vec3 v = samplePos - kernelPos;
|
|
||||||
float distanceSquare = dot(v, v);
|
|
||||||
float nDotV = dot(normal, v) * inversesqrt(distanceSquare);
|
|
||||||
return clamp(nDotV - NDotVBias, 0.0, 1.0) * clamp(distanceSquare * NegInvR2 + 1.0, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculates the total ambient occlusion for the entire fragment
|
|
||||||
float ComputeAO(vec3 viewPosition, vec3 viewNormal)
|
|
||||||
{
|
|
||||||
vec4 rand = GetJitter();
|
|
||||||
|
|
||||||
float radiusPixels = RadiusToScreen / viewPosition.z;
|
|
||||||
float stepSizePixels = radiusPixels / (NUM_STEPS + 1.0);
|
|
||||||
|
|
||||||
const float directionAngleStep = 2.0 * PI / NUM_DIRECTIONS;
|
|
||||||
float ao = 0.0;
|
|
||||||
|
|
||||||
for (float directionIndex = 0.0; directionIndex < NUM_DIRECTIONS; ++directionIndex)
|
|
||||||
{
|
|
||||||
float angle = directionAngleStep * directionIndex;
|
|
||||||
|
|
||||||
vec2 direction = RotateDirection(vec2(cos(angle), sin(angle)), rand.xy);
|
|
||||||
float rayPixels = (rand.z * stepSizePixels + 1.0);
|
|
||||||
|
|
||||||
for (float StepIndex = 0.0; StepIndex < NUM_STEPS; ++StepIndex)
|
|
||||||
{
|
|
||||||
vec2 sampleUV = round(rayPixels * direction) * InvFullResolution + TexCoord;
|
|
||||||
vec3 samplePos = FetchViewPos(sampleUV);
|
|
||||||
ao += ComputeSampleAO(viewPosition, viewNormal, samplePos);
|
|
||||||
rayPixels += stepSizePixels;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ao *= AOMultiplier / (NUM_DIRECTIONS * NUM_STEPS);
|
|
||||||
return clamp(1.0 - ao * 2.0, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec3 viewPosition = FetchViewPos(TexCoord);
|
|
||||||
vec3 viewNormal = FetchNormal(TexCoord);
|
|
||||||
float occlusion = viewNormal != vec3(0.0) ? ComputeAO(viewPosition, viewNormal) * AOStrength + (1.0 - AOStrength) : 1.0;
|
|
||||||
|
|
||||||
FragColor = vec4(occlusion, viewPosition.z, 0.0, 1.0);
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D AODepthTexture;
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
layout(binding=1) uniform sampler2DMS SceneFogTexture;
|
|
||||||
#else
|
|
||||||
layout(binding=1) uniform sampler2D SceneFogTexture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec2 uv = Offset + TexCoord * Scale;
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
ivec2 texSize = textureSize(SceneFogTexture);
|
|
||||||
#else
|
|
||||||
ivec2 texSize = textureSize(SceneFogTexture, 0);
|
|
||||||
#endif
|
|
||||||
ivec2 ipos = ivec2(uv * vec2(texSize));
|
|
||||||
|
|
||||||
#if defined(MULTISAMPLE)
|
|
||||||
vec3 fogColor = texelFetch(SceneFogTexture, ipos, 0).rgb;
|
|
||||||
#else
|
|
||||||
vec3 fogColor = texelFetch(SceneFogTexture, ipos, 0).rgb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec4 ssao = texture(AODepthTexture, TexCoord);
|
|
||||||
float attenutation = ssao.x;
|
|
||||||
|
|
||||||
if (DebugMode == 0)
|
|
||||||
FragColor = vec4(fogColor, 1.0 - attenutation);
|
|
||||||
else if (DebugMode < 3)
|
|
||||||
FragColor = vec4(attenutation, attenutation, attenutation, 1.0);
|
|
||||||
else if (DebugMode == 3)
|
|
||||||
FragColor = vec4(ssao.yyy / 1000.0, 1.0);
|
|
||||||
else
|
|
||||||
FragColor = vec4(ssao.xyz, 1.0);
|
|
||||||
}
|
|
|
@ -1,89 +0,0 @@
|
||||||
|
|
||||||
layout(location=0) in vec2 TexCoord;
|
|
||||||
layout(location=0) out vec4 FragColor;
|
|
||||||
|
|
||||||
layout(binding=0) uniform sampler2D InputTexture;
|
|
||||||
|
|
||||||
vec3 Linear(vec3 c)
|
|
||||||
{
|
|
||||||
//c = max(c, vec3(0.0));
|
|
||||||
//return pow(c, 2.2);
|
|
||||||
return c * c; // cheaper, but assuming gamma of 2.0 instead of 2.2
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 sRGB(vec3 c)
|
|
||||||
{
|
|
||||||
c = max(c, vec3(0.0));
|
|
||||||
//return pow(c, vec3(1.0 / 2.2));
|
|
||||||
return sqrt(c); // cheaper, but assuming gamma of 2.0 instead of 2.2
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(LINEAR)
|
|
||||||
|
|
||||||
vec3 Tonemap(vec3 color)
|
|
||||||
{
|
|
||||||
return sRGB(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(REINHARD)
|
|
||||||
|
|
||||||
vec3 Tonemap(vec3 color)
|
|
||||||
{
|
|
||||||
color = color / (1.0 + color);
|
|
||||||
return sRGB(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(HEJLDAWSON)
|
|
||||||
|
|
||||||
vec3 Tonemap(vec3 color)
|
|
||||||
{
|
|
||||||
vec3 x = max(vec3(0.0), color - 0.004);
|
|
||||||
return (x * (6.2 * x + 0.5)) / (x * (6.2 * x + 1.7) + 0.06); // no sRGB needed
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(UNCHARTED2)
|
|
||||||
|
|
||||||
vec3 Uncharted2Tonemap(vec3 x)
|
|
||||||
{
|
|
||||||
float A = 0.15;
|
|
||||||
float B = 0.50;
|
|
||||||
float C = 0.10;
|
|
||||||
float D = 0.20;
|
|
||||||
float E = 0.02;
|
|
||||||
float F = 0.30;
|
|
||||||
return ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - E / F;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 Tonemap(vec3 color)
|
|
||||||
{
|
|
||||||
float W = 11.2;
|
|
||||||
vec3 curr = Uncharted2Tonemap(color);
|
|
||||||
vec3 whiteScale = vec3(1) / Uncharted2Tonemap(vec3(W));
|
|
||||||
return sRGB(curr * whiteScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(PALETTE)
|
|
||||||
|
|
||||||
layout(binding=1) uniform sampler2D PaletteLUT;
|
|
||||||
|
|
||||||
vec3 Tonemap(vec3 color)
|
|
||||||
{
|
|
||||||
ivec3 c = ivec3(clamp(color.rgb, vec3(0.0), vec3(1.0)) * 63.0 + 0.5);
|
|
||||||
int index = (c.r * 64 + c.g) * 64 + c.b;
|
|
||||||
int tx = index % 512;
|
|
||||||
int ty = index / 512;
|
|
||||||
return texelFetch(PaletteLUT, ivec2(tx, ty), 0).rgb;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error Tonemap mode define is missing
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec3 color = texture(InputTexture, TexCoord).rgb;
|
|
||||||
#ifndef PALETTE
|
|
||||||
color = Linear(color); // needed because gzdoom's scene texture is not linear at the moment
|
|
||||||
#endif
|
|
||||||
FragColor = vec4(Tonemap(color), 1.0);
|
|
||||||
}
|
|
Loading…
Reference in a new issue