Update ToGLES( fix occlusion query and other small things )
This commit is contained in:
parent
d651c2b38d
commit
ead7bfc155
@ -42,6 +42,7 @@ void GLMRendererInfo::Init( GLMRendererInfoFields *info )
|
||||
m_info.m_atiNewer = true;
|
||||
|
||||
m_info.m_hasGammaWrites = true;
|
||||
m_info.m_cantAttachSRGB = false;
|
||||
|
||||
// If you haven't created a GL context by now (and initialized gGL), you're about to crash.
|
||||
|
||||
|
@ -60,6 +60,7 @@ const int kBogusSwapInterval = INT_MAX;
|
||||
#if defined ANDROID || defined TOGLES
|
||||
static void *l_gl4es = NULL;
|
||||
static void *l_egl = NULL;
|
||||
static void *l_gles = NULL;
|
||||
|
||||
typedef void *(*t_glGetProcAddress)( const char * );
|
||||
t_glGetProcAddress _glGetProcAddress;
|
||||
@ -194,7 +195,14 @@ void *VoidFnPtrLookup_GlMgr(const char *fn, bool &okay, const bool bRequired, vo
|
||||
#if defined ANDROID || defined TOGLES
|
||||
// SDL does the right thing, so we never need to use tier0 in this case.
|
||||
if( _glGetProcAddress )
|
||||
{
|
||||
retval = _glGetProcAddress(fn);
|
||||
|
||||
Msg("_glGetProcAddress(%s) = %x\n", fn, retval);
|
||||
|
||||
if( !retval && l_gles )
|
||||
retval = dlsym( l_gles, fn );
|
||||
}
|
||||
//printf("CDynamicFunctionOpenGL: SDL_GL_GetProcAddress(\"%s\") returned %p\n", fn, retval);
|
||||
if ((retval == NULL) && (fallback != NULL))
|
||||
{
|
||||
@ -507,8 +515,8 @@ InitReturnVal_t CSDLMgr::Init()
|
||||
SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG );
|
||||
}
|
||||
|
||||
#ifdef TOGLES
|
||||
if (SDL_GL_LoadLibrary("libGLESv2.so") == -1)
|
||||
#if defined( TOGLES )
|
||||
if (SDL_GL_LoadLibrary("libGLESv3.so") == -1)
|
||||
#else
|
||||
if (SDL_GL_LoadLibrary(NULL) == -1)
|
||||
#endif
|
||||
@ -583,6 +591,7 @@ InitReturnVal_t CSDLMgr::Init()
|
||||
|
||||
#ifdef TOGLES
|
||||
l_egl = dlopen("libEGL.so", RTLD_LAZY);
|
||||
l_gles = dlopen("libGLESv3.so", RTLD_LAZY);
|
||||
|
||||
if( l_egl )
|
||||
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_egl, "eglGetProcAddress");
|
||||
@ -590,7 +599,6 @@ InitReturnVal_t CSDLMgr::Init()
|
||||
SET_GL_ATTR(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
SET_GL_ATTR(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
SET_GL_ATTR(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
|
||||
#elif ANDROID
|
||||
bool m_bOGL = false;
|
||||
|
||||
@ -1405,6 +1413,7 @@ void CSDLMgr::ShowPixels( CShowPixelsParams *params )
|
||||
|
||||
m_flPrevGLSwapWindowTime = tm.GetDurationInProgress().GetMillisecondsF();
|
||||
|
||||
|
||||
CheckGLError( __LINE__ );
|
||||
}
|
||||
#endif // DX_TO_GL_ABSTRACTION
|
||||
|
@ -811,7 +811,7 @@ void CHud::RefreshHudTextures()
|
||||
|
||||
// check to see if we have sprites for this res; if not, step down
|
||||
LoadHudTextures( textureList, "scripts/hud_textures", NULL );
|
||||
//LoadHudTextures( textureList, "scripts/mod_textures", NULL );
|
||||
LoadHudTextures( textureList, "scripts/mod_textures", NULL );
|
||||
|
||||
// fix up all the texture icons first
|
||||
int c = textureList.Count();
|
||||
|
@ -1872,7 +1872,12 @@ void CMaterialSystem::ReadConfigFromConVars( MaterialSystem_Config_t *pConfig )
|
||||
pConfig->m_fGammaTVExponent = mat_monitorgamma_tv_exp.GetFloat();
|
||||
pConfig->m_bGammaTVEnabled = mat_monitorgamma_tv_enabled.GetBool();
|
||||
|
||||
#ifdef TOGLES
|
||||
pConfig->m_nAASamples = 0;
|
||||
#else
|
||||
pConfig->m_nAASamples = mat_antialias.GetInt();
|
||||
#endif
|
||||
|
||||
pConfig->m_nAAQuality = mat_aaquality.GetInt();
|
||||
pConfig->bShowDiffuse = mat_diffuse.GetInt() ? true : false;
|
||||
// pConfig->bAllowCheats = false; // hack
|
||||
|
@ -160,13 +160,16 @@ static FILE *GetDebugFileHandle( void )
|
||||
#ifdef DX_TO_GL_ABSTRACTION
|
||||
// mat_autoload_glshaders instructs the engine to load a cached shader table at startup
|
||||
// it will try for glshaders.cfg first, then fall back to glbaseshaders.cfg if not found
|
||||
ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "1" );
|
||||
|
||||
// mat_autosave_glshaders instructs the engine to save out the shader table at key points
|
||||
// to the filename glshaders.cfg
|
||||
//
|
||||
ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "1" );
|
||||
|
||||
#ifdef ANDROID
|
||||
ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "0" );
|
||||
ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "0" );
|
||||
#else
|
||||
ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "1" );
|
||||
ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "1" );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -38,8 +38,18 @@
|
||||
#include "interface.h"
|
||||
#include "togles/rendermechanism.h"
|
||||
|
||||
#ifdef LINUX
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
void *VoidFnPtrLookup_GlMgr(const char *fn, bool &okay, const bool bRequired, void *fallback=NULL);
|
||||
|
||||
/*
|
||||
#define GL_USE_EXECUTE_HELPER_FOR_ALL_API_CALLS 1
|
||||
#define GL_TRACK_API_TIME 1
|
||||
#define GL_DUMP_ALL_API_CALLS 1
|
||||
*/
|
||||
|
||||
#if GL_USE_EXECUTE_HELPER_FOR_ALL_API_CALLS
|
||||
class CGLExecuteHelperBase
|
||||
{
|
||||
@ -47,7 +57,7 @@ public:
|
||||
inline void StartCall(const char *pName);
|
||||
inline void StopCall(const char *pName);
|
||||
#if GL_TRACK_API_TIME
|
||||
TmU64 m_nStartTime;
|
||||
uint64 m_nStartTime;
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -312,9 +322,10 @@ public:
|
||||
#define GL_FUNC(ext,req,ret,fn,arg,call) CDynamicFunctionOpenGL< req, ret (*) arg, ret > fn;
|
||||
#define GL_FUNC_VOID(ext,req,fn,arg,call) CDynamicFunctionOpenGL< req, void (*) arg, void > fn;
|
||||
#else
|
||||
#define _APIENTRY __attribute__((pcs("aapcs"))) APIENTRY
|
||||
#define GL_EXT(x,glmajor,glminor) bool m_bHave_##x;
|
||||
#define GL_FUNC(ext,req,ret,fn,arg,call) CDynamicFunctionOpenGL< req, ret (APIENTRY *) arg, ret > fn;
|
||||
#define GL_FUNC_VOID(ext,req,fn,arg,call) CDynamicFunctionOpenGL< req, void (APIENTRY *) arg, void > fn;
|
||||
#define GL_FUNC(ext,req,ret,fn,arg,call) CDynamicFunctionOpenGL< req, ret (_APIENTRY *) arg, ret > fn;
|
||||
#define GL_FUNC_VOID(ext,req,fn,arg,call) CDynamicFunctionOpenGL< req, void (_APIENTRY *) arg, void > fn;
|
||||
#endif
|
||||
#include "togles/glfuncs.inl"
|
||||
#undef GL_FUNC_VOID
|
||||
@ -347,54 +358,30 @@ typedef void * (*GL_GetProcAddressCallbackFunc_t)(const char *, bool &, const bo
|
||||
DLL_IMPORT void ClearOpenGLEntryPoints();
|
||||
#endif
|
||||
|
||||
inline uint64 get_nsecs()
|
||||
{
|
||||
struct timespec time={0,0};
|
||||
clock_gettime(CLOCK_MONOTONIC, &time);
|
||||
return time.tv_nsec;
|
||||
}
|
||||
|
||||
#if GL_USE_EXECUTE_HELPER_FOR_ALL_API_CALLS
|
||||
inline void CGLExecuteHelperBase::StartCall(const char *pName)
|
||||
{
|
||||
(void)pName;
|
||||
|
||||
#if GL_TELEMETRY_ZONES
|
||||
tmEnter( TELEMETRY_LEVEL3, TMZF_NONE, pName );
|
||||
#endif
|
||||
|
||||
#if GL_TRACK_API_TIME
|
||||
m_nStartTime = tmFastTime();
|
||||
#endif
|
||||
|
||||
#if GL_DUMP_ALL_API_CALLS
|
||||
static bool s_bDumpCalls;
|
||||
if ( s_bDumpCalls )
|
||||
{
|
||||
char buf[128];
|
||||
buf[0] = 'G';
|
||||
buf[1] = 'L';
|
||||
buf[2] = ':';
|
||||
size_t l = strlen( pName );
|
||||
memcpy( buf + 3, pName, l );
|
||||
buf[3 + l] = '\n';
|
||||
buf[4 + l] = '\0';
|
||||
Plat_DebugString( buf );
|
||||
}
|
||||
#endif
|
||||
m_nStartTime = get_nsecs();
|
||||
}
|
||||
|
||||
inline void CGLExecuteHelperBase::StopCall(const char *pName)
|
||||
{
|
||||
#if GL_TRACK_API_TIME
|
||||
uint64 nTotalCycles = tmFastTime() - m_nStartTime;
|
||||
#endif
|
||||
|
||||
#if GL_TELEMETRY_ZONES
|
||||
tmLeave( TELEMETRY_LEVEL3 );
|
||||
#endif
|
||||
|
||||
#if GL_TRACK_API_TIME
|
||||
//double flMilliseconds = g_Telemetry.flRDTSCToMilliSeconds * nTotalCycles;
|
||||
if (gGL)
|
||||
if( gGL )
|
||||
{
|
||||
gGL->m_nTotalGLCycles += nTotalCycles;
|
||||
gGL->m_nTotalGLCalls++;
|
||||
uint64 time = get_nsecs() - m_nStartTime;
|
||||
printf("Function %s finished in %llu\n", pName, time);
|
||||
|
||||
if( strcmp(pName, "glBufferSubData") == 0 && time > 1000000 )
|
||||
DebuggerBreak();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -36,7 +36,6 @@ GL_FUNC_VOID(OpenGL,true,glBlendEquation,(GLenum a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glBlendFunc,(GLenum a,GLenum b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glBufferData,(GLenum a, GLsizeiptr b, const GLvoid *c,GLenum d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glClear,(GLbitfield a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glClearDepthf,(GLfloat a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glClearColor,(GLclampf a,GLclampf b,GLclampf c,GLclampf d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glReadPixels, (GLint a, GLint b, GLsizei c, GLsizei d, GLenum e, GLenum f, void * g), (a,b,c,d,e,f,g))
|
||||
GL_FUNC_VOID(OpenGL,true,glClearStencil,(GLint a),(a))
|
||||
@ -55,13 +54,18 @@ GL_FUNC_VOID(OpenGL,true,glDeleteShader,(GLuint a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glDeleteTextures,(GLsizei a,const GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glDepthFunc,(GLenum a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glDepthMask,(GLboolean a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glDepthRangef,(GLfloat a,GLfloat b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glDisable,(GLenum a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glDisableVertexAttribArray,(GLuint a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glDrawArrays,(GLenum a,GLint b,GLsizei c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glDrawBuffers,(GLsizei a,const GLenum *b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glDetachShader,(GLuint a,GLuint b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glDrawRangeElements,(GLenum a,GLuint b,GLuint c,GLsizei d,GLenum e,const GLvoid *f),(a,b,c,d,e,f))
|
||||
GL_FUNC_VOID(OpenGL,true,glGetSynciv,(GLsync a, GLenum b, GLsizei c, GLsizei *d, GLint *e),(a,b,c,d,e))
|
||||
GL_FUNC(OpenGL,true,GLenum,glClientWaitSync,(GLsync a, GLbitfield b, GLuint64 c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glWaitSync,(GLsync a, GLbitfield b, GLuint64 c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glDeleteSync,(GLsync a),(a))
|
||||
GL_FUNC(OpenGL,true,GLsync,glFenceSync,(GLenum a, GLbitfield b),(a,b))
|
||||
|
||||
#ifndef OSX // 10.6/GL 2.1 compatability
|
||||
GL_FUNC_VOID(OpenGL,true,glDrawRangeElementsBaseVertex,(GLenum a,GLuint b,GLuint c,GLsizei d,GLenum e,const GLvoid *f, GLenum g),(a,b,c,d,e,f,g))
|
||||
#endif
|
||||
@ -73,7 +77,6 @@ GL_FUNC_VOID(OpenGL,true,glFrontFace,(GLenum a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glGenBuffers,(GLsizei a,GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glGenTextures,(GLsizei a,GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glGetBooleanv,(GLenum a,GLboolean *b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glGetFloatv,(GLenum a,GLfloat *b),(a,b))
|
||||
//GL_FUNC_VOID(OpenGL,true,glGetInfoLog,(GLuint a,GLsizei b,GLsizei *c,GLchar *d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glGetIntegerv,(GLenum a,GLint *b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glGetProgramiv,(GLenum a,GLenum b,GLint *c),(a,b,c))
|
||||
@ -85,7 +88,6 @@ GL_FUNC_VOID(OpenGL,true,glLinkProgram,(GLuint a),(a))
|
||||
//GL_FUNC_VOID(OpenGL,true,glOrtho,(GLdouble a,GLdouble b,GLdouble c,GLdouble d,GLdouble e,GLdouble f),(a,b,c,d,e,f))
|
||||
GL_FUNC_VOID(OpenGL,true,glPixelStorei,(GLenum a,GLint b),(a,b))
|
||||
//GL_FUNC_VOID(OpenGL,true,glPolygonMode,(GLenum a,GLenum b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glPolygonOffset,(GLfloat a,GLfloat b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glReadBuffer,(GLenum a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glScissor,(GLint a,GLint b,GLsizei c,GLsizei d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glShaderSource,(GLuint a,GLsizei b,const GLchar **c,const GLint *d),(a,b,c,d))
|
||||
@ -94,12 +96,9 @@ GL_FUNC_VOID(OpenGL,true,glStencilMask,(GLuint a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glStencilOp,(GLenum a,GLenum b,GLenum c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glTexImage2D,(GLenum a,GLint b,GLint c,GLsizei d,GLsizei e,GLint f,GLenum g,GLenum h,const GLvoid *i),(a,b,c,d,e,f,g,h,i))
|
||||
GL_FUNC_VOID(OpenGL,true,glTexImage3D,(GLenum a,GLint b,GLint c,GLsizei d,GLsizei e,GLsizei f,GLint g,GLenum h,GLenum i,const GLvoid *j),(a,b,c,d,e,f,g,h,i,j))
|
||||
GL_FUNC_VOID(OpenGL,true,glTexParameterfv,(GLenum a,GLenum b,const GLfloat *c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glTexParameteri,(GLenum a,GLenum b,GLint c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glTexSubImage2D,(GLenum a,GLint b,GLint c,GLint d,GLsizei e,GLsizei f,GLenum g,GLenum h,const GLvoid *i),(a,b,c,d,e,f,g,h,i))
|
||||
GL_FUNC_VOID(OpenGL,true,glUniform1f,(GLint a,GLfloat b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glUniform1i,(GLint a,GLint b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glUniform4fv,(GLint a,GLsizei b,const GLfloat *c),(a,b,c))
|
||||
GL_FUNC(OpenGL,true,GLboolean,glUnmapBuffer,(GLenum a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glUseProgram,(GLuint a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glVertexAttribPointer,(GLuint a,GLint b,GLenum c,GLboolean d,GLsizei e,const GLvoid *f),(a,b,c,d,e,f))
|
||||
@ -108,22 +107,8 @@ GL_FUNC_VOID(OpenGL,true,glClientActiveTexture,(GLenum a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glStencilOpSeparate,(GLenum a,GLenum b,GLenum c,GLenum d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glStencilFuncSeparate,(GLenum a,GLenum b,GLint c,GLuint d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glGetTexLevelParameteriv,(GLenum a,GLint b,GLenum c,GLint *d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glColor4f,(GLfloat a,GLfloat b,GLfloat c,GLfloat d),(a,b,c,d))
|
||||
GL_EXT(GL_EXT_framebuffer_object,-1,-1)
|
||||
GL_EXT(GL_EXT_framebuffer_blit,-1,-1)
|
||||
GL_EXT(GL_EXT_framebuffer_multisample,-1,-1)
|
||||
/*GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glBindFramebufferEXT,(GLenum a,GLuint b),(a,b))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glBindRenderbufferEXT,(GLenum a,GLuint b),(a,b))
|
||||
GL_FUNC(GL_EXT_framebuffer_object,false,GLenum,glCheckFramebufferStatusEXT,(GLenum a),(a))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glDeleteRenderbuffersEXT,(GLsizei a,const GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glFramebufferRenderbufferEXT,(GLenum a,GLenum b,GLenum c,GLuint d),(a,b,c,d))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glFramebufferTexture2DEXT,(GLenum a,GLenum b,GLenum c,GLuint d,GLint e),(a,b,c,d,e))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glFramebufferTexture3DEXT,(GLenum a,GLenum b,GLenum c,GLuint d,GLint e,GLint f),(a,b,c,d,e,f))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glGenFramebuffersEXT,(GLsizei a,GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glGenRenderbuffersEXT,(GLsizei a,GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_object,false,glDeleteFramebuffersEXT,(GLsizei a,const GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_blit,false,glBlitFramebufferEXT,(GLint a,GLint b,GLint c,GLint d,GLint e,GLint f,GLint g,GLint h,GLbitfield i,GLenum j),(a,b,c,d,e,f,g,h,i,j))
|
||||
GL_FUNC_VOID(GL_EXT_framebuffer_multisample,false,glRenderbufferStorageMultisampleEXT,(GLenum a,GLsizei b,GLenum c,GLsizei d,GLsizei e),(a,b,c,d,e))*/
|
||||
GL_EXT(GL_APPLE_fence,-1,-1)
|
||||
GL_FUNC(GL_APPLE_fence,false,GLboolean,glTestFenceAPPLE,(GLuint a),(a))
|
||||
GL_FUNC_VOID(GL_APPLE_fence,false,glSetFenceAPPLE,(GLuint a),(a))
|
||||
@ -137,13 +122,8 @@ GL_FUNC_VOID(GL_NV_fence,false,glFinishFenceNV,(GLuint a),(a))
|
||||
GL_FUNC_VOID(GL_NV_fence,false,glDeleteFencesNV,(GLsizei a,const GLuint *b),(a,b))
|
||||
GL_FUNC_VOID(GL_NV_fence,false,glGenFencesNV,(GLsizei a,GLuint *b),(a,b))
|
||||
GL_EXT(GL_ARB_sync,3,2)
|
||||
#ifdef HAVE_GL_ARB_SYNC
|
||||
GL_FUNC_VOID(GL_ARB_sync,false,glGetSynciv,(GLsync a, GLenum b, GLsizei c, GLsizei *d, GLint *e),(a,b,c,d,e))
|
||||
GL_FUNC(GL_ARB_sync,false,GLenum,glClientWaitSync,(GLsync a, GLbitfield b, GLuint64 c),(a,b,c))
|
||||
GL_FUNC_VOID(GL_ARB_sync,false,glWaitSync,(GLsync a, GLbitfield b, GLuint64 c),(a,b,c))
|
||||
GL_FUNC_VOID(GL_ARB_sync,false,glDeleteSync,(GLsync a),(a))
|
||||
GL_FUNC(GL_ARB_sync,false,GLsync,glFenceSync,(GLenum a, GLbitfield b),(a,b))
|
||||
#endif
|
||||
//#ifdef HAVE_GL_ARB_SYNC
|
||||
//#endif
|
||||
GL_EXT(GL_EXT_bindable_uniform,-1,-1)
|
||||
GL_FUNC_VOID(GL_EXT_bindable_uniform,false,glUniformBufferEXT,(GLuint a,GLint b,GLuint c),(a,b,c))
|
||||
GL_FUNC(GL_EXT_bindable_uniform,false,int,glGetUniformBufferSizeEXT,(GLenum a, GLenum b),(a,b))
|
||||
@ -165,6 +145,7 @@ GL_EXT(GL_APPLE_client_storage,-1,-1)
|
||||
GL_EXT(GL_ARB_uniform_buffer,-1,-1)
|
||||
GL_EXT(GL_ARB_vertex_array_bgra,-1,-1)
|
||||
GL_EXT(GL_EXT_vertex_array_bgra,-1,-1)
|
||||
GL_EXT(GL_EXT_framebuffer_multisample_blit_scaled,-1,-1)
|
||||
|
||||
GL_EXT(GL_ARB_framebuffer_object,3,0)
|
||||
/*GL_FUNC_VOID(GL_ARB_framebuffer_object,false,glBindFramebuffer,(GLenum a,GLuint b),(a,b))
|
||||
@ -208,9 +189,7 @@ GL_FUNC_VOID(OpenGL, true, glGenSamplers, (GLuint a, GLuint *b), (a, b))
|
||||
GL_FUNC_VOID(OpenGL, true, glDeleteSamplers, (GLsizei a, const GLuint *b), (a, b))
|
||||
GL_FUNC_VOID(OpenGL, true, glBindSampler, (GLuint a, GLuint b), (a, b))
|
||||
GL_FUNC_VOID(OpenGL, true, glSamplerParameteri, (GLuint a, GLenum b, GLint c), (a, b, c))
|
||||
GL_FUNC_VOID(OpenGL, true, glSamplerParameterf, (GLuint a, GLenum b, GLfloat c), (a, b, c))
|
||||
GL_FUNC_VOID(OpenGL, true, glSamplerParameterfv, (GLuint a, GLenum b, const GLfloat *c), (a, b, c))
|
||||
GL_FUNC(GL_NV_bindless_texture, false, GLuint64, glGetTextureHandleNV, (GLuint texture), (texture))
|
||||
/*GL_FUNC(GL_NV_bindless_texture, false, GLuint64, glGetTextureHandleNV, (GLuint texture), (texture))
|
||||
GL_FUNC(GL_NV_bindless_texture, false, GLuint64, glGetTextureSamplerHandleNV, (GLuint texture, GLuint sampler), (texture, sampler))
|
||||
GL_FUNC_VOID(GL_NV_bindless_texture, false, glMakeTextureHandleResidentNV, (GLuint64 handle), (handle))
|
||||
GL_FUNC_VOID(GL_NV_bindless_texture, false, glMakeTextureHandleNonResidentNV, (GLuint64 handle), (handle))
|
||||
@ -218,7 +197,7 @@ GL_FUNC_VOID(GL_NV_bindless_texture, false, glUniformHandleui64NV, (GLint locati
|
||||
GL_FUNC_VOID(GL_NV_bindless_texture, false, glUniformHandleui64vNV, (int location, GLsizei count, const GLuint64 *value), (location count, value))
|
||||
GL_FUNC_VOID(GL_NV_bindless_texture, false, glProgramUniformHandleui64NV, (GLuint program, GLint location, GLuint64 value), (program, location, value))
|
||||
GL_FUNC_VOID(GL_NV_bindless_texture, false, glProgramUniformHandleui64vNV, (GLuint program, GLint location, GLsizei count, const GLuint64 *values), (program, location, count, values))
|
||||
GL_FUNC(GL_NV_bindless_texture, false, GLboolean, glIsTextureHandleResidentNV, (GLuint64 handle), (handle))
|
||||
GL_FUNC(GL_NV_bindless_texture, false, GLboolean, glIsTextureHandleResidentNV, (GLuint64 handle), (handle))*/
|
||||
GL_FUNC_VOID(OpenGL,true,glGenQueries,(GLsizei n, GLuint *ids), (n, ids))
|
||||
GL_FUNC_VOID(OpenGL,true,glDeleteQueries,(GLsizei n, const GLuint *ids),(n, ids))
|
||||
GL_FUNC_VOID(OpenGL,true,glBeginQuery,(GLenum target, GLuint id), (target, id))
|
||||
@ -227,7 +206,6 @@ GL_FUNC_VOID(OpenGL,true,glCopyBufferSubData,(GLenum readtarget, GLenum writetar
|
||||
#endif // !OSX
|
||||
|
||||
GL_EXT(GL_AMD_pinned_memory,-1,-1)
|
||||
GL_EXT(GL_EXT_framebuffer_multisample_blit_scaled,-1,-1)
|
||||
|
||||
#ifndef OSX
|
||||
GL_FUNC_VOID(OpenGL,true,glGenVertexArrays,(GLsizei n, GLuint *arrays),(n, arrays))
|
||||
@ -235,6 +213,9 @@ GL_FUNC_VOID(OpenGL,true,glDeleteVertexArrays,(GLsizei n, GLuint *arrays),(n, ar
|
||||
GL_FUNC_VOID(OpenGL,true,glBindVertexArray,(GLuint a),(a))
|
||||
#endif // !OSX
|
||||
|
||||
GL_EXT(GL_QCOM_alpha_test,-1,-1)
|
||||
|
||||
|
||||
GL_EXT(GL_EXT_texture_sRGB_decode,-1,-1)
|
||||
GL_EXT(GL_NVX_gpu_memory_info,-1,-1)
|
||||
GL_EXT(GL_ATI_meminfo,-1,-1)
|
||||
@ -243,8 +224,12 @@ GL_EXT(GL_EXT_texture_compression_dxt1,-1,-1)
|
||||
GL_EXT(GL_ANGLE_texture_compression_dxt3,-1,-1)
|
||||
GL_EXT(GL_ANGLE_texture_compression_dxt5,-1,-1)
|
||||
|
||||
GL_EXT( GL_EXT_color_buffer_half_float, -1, -1 )
|
||||
GL_EXT( GL_EXT_texture_norm16, -1, -1 )
|
||||
GL_EXT( GL_EXT_buffer_storage, -1, -1 )
|
||||
GL_FUNC_VOID( GL_EXT_buffer_storage, false, glBufferStorageEXT, (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags), (target, size, data, flags) )
|
||||
//GL_FUNC_VOID(OpenGL, false,glGetTexImage,(GLenum a,GLint b,GLenum c,GLenum d,GLvoid *e),(a,b,c,d,e))
|
||||
|
||||
|
||||
// This one is an OS extension. We'll add a little helper function to look for it.
|
||||
#ifdef _WIN32
|
||||
@ -252,3 +237,15 @@ GL_FUNC_VOID( GL_EXT_buffer_storage, false, glBufferStorageEXT, (GLenum target,
|
||||
#else
|
||||
GL_EXT(GLX_EXT_swap_control_tear,-1,-1)
|
||||
#endif
|
||||
|
||||
GL_FUNC_VOID(OpenGL,true,glGetFloatv,(GLenum a,GLfloat *b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glPolygonOffset,(GLfloat a,GLfloat b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glTexParameterfv,(GLenum a,GLenum b,const GLfloat *c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glUniform1f,(GLint a,GLfloat b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glUniform4fv,(GLint a,GLsizei b,const GLfloat *c),(a,b,c))
|
||||
GL_FUNC_VOID(OpenGL,true,glColor4f,(GLfloat a,GLfloat b,GLfloat c,GLfloat d),(a,b,c,d))
|
||||
GL_FUNC_VOID(OpenGL,true,glSamplerParameterf,(GLuint a, GLenum b, GLfloat c), (a, b, c))
|
||||
GL_FUNC_VOID(OpenGL,true,glSamplerParameterfv,(GLuint a, GLenum b, const GLfloat *c), (a, b, c))
|
||||
GL_FUNC_VOID(GL_QCOM_alpha_test,false,glAlphaFuncQCOM,(GLenum a, GLfloat b),(a,b))
|
||||
GL_FUNC_VOID(OpenGL,true,glClearDepthf,(GLfloat a),(a))
|
||||
GL_FUNC_VOID(OpenGL,true,glDepthRangef,(GLfloat a,GLfloat b),(a,b))
|
||||
|
@ -55,7 +55,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//===============================================================================
|
||||
// debug channels
|
||||
|
||||
|
@ -65,6 +65,10 @@
|
||||
#define GLM_OPENGL_DEFAULT_DEVICE_ID 1
|
||||
#define GLM_OPENGL_LOW_PERF_DEVICE_ID 2
|
||||
|
||||
#define GL_ALPHA_TEST_QCOM 0x0BC0
|
||||
#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
|
||||
#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
|
||||
|
||||
extern void GLMDebugPrintf( const char *pMsg, ... );
|
||||
|
||||
extern uint g_nTotalDrawsOrClears, g_nTotalVBLockBytes, g_nTotalIBLockBytes;
|
||||
@ -314,13 +318,17 @@ static GLAlphaTest_t g_alpha_test;
|
||||
// --- GLAlphaTestEnable ---
|
||||
FORCEINLINE void GLContextSet( GLAlphaTestEnable_t *src )
|
||||
{
|
||||
// glSetEnable( GL_ALPHA_TEST, src->enable != 0 );
|
||||
if( gGL->m_bHave_GL_QCOM_alpha_test )
|
||||
glSetEnable( GL_ALPHA_TEST_QCOM, src->enable != 0 );
|
||||
else
|
||||
g_alpha_test.enable = src->enable;
|
||||
}
|
||||
|
||||
FORCEINLINE void GLContextGet( GLAlphaTestEnable_t *dst )
|
||||
{
|
||||
// dst->enable = gGL->glIsEnabled( GL_ALPHA_TEST );
|
||||
if( gGL->m_bHave_GL_QCOM_alpha_test )
|
||||
dst->enable = gGL->glIsEnabled( GL_ALPHA_TEST_QCOM );
|
||||
else
|
||||
dst->enable = g_alpha_test.enable;
|
||||
}
|
||||
|
||||
@ -332,17 +340,25 @@ FORCEINLINE void GLContextGetDefault( GLAlphaTestEnable_t *dst )
|
||||
// --- GLAlphaTestFunc ---
|
||||
FORCEINLINE void GLContextSet( GLAlphaTestFunc_t *src )
|
||||
{
|
||||
// gGL->glAlphaFunc( src->func, src->ref );
|
||||
if( gGL->m_bHave_GL_QCOM_alpha_test )
|
||||
gGL->glAlphaFuncQCOM( src->func, src->ref );
|
||||
|
||||
g_alpha_test.func = src->func;
|
||||
g_alpha_test.ref = src->ref;
|
||||
}
|
||||
|
||||
FORCEINLINE void GLContextGet( GLAlphaTestFunc_t *dst )
|
||||
{
|
||||
// glGetEnumv( GL_ALPHA_TEST_FUNC, &dst->func );
|
||||
// gGL->glGetFloatv( GL_ALPHA_TEST_REF, &dst->ref );
|
||||
if( gGL->m_bHave_GL_QCOM_alpha_test )
|
||||
{
|
||||
glGetEnumv( GL_ALPHA_TEST_FUNC_QCOM, &dst->func );
|
||||
gGL->glGetFloatv( GL_ALPHA_TEST_REF_QCOM, &dst->ref );
|
||||
}
|
||||
else
|
||||
{
|
||||
dst->func = g_alpha_test.func;
|
||||
dst->ref = g_alpha_test.ref;
|
||||
}
|
||||
}
|
||||
|
||||
FORCEINLINE void GLContextGetDefault( GLAlphaTestFunc_t *dst )
|
||||
@ -723,8 +739,8 @@ FORCEINLINE void GLContextSet( GLBlendEnableSRGB_t *src )
|
||||
|
||||
FORCEINLINE void GLContextGet( GLBlendEnableSRGB_t *dst )
|
||||
{
|
||||
// dst->enable = gGL->glIsEnabled( GL_FRAMEBUFFER_SRGB_EXT );
|
||||
dst->enable = true; // wtf ?
|
||||
dst->enable = gGL->glIsEnabled( GL_FRAMEBUFFER_SRGB_EXT );
|
||||
// dst->enable = true; // wtf ?
|
||||
}
|
||||
|
||||
FORCEINLINE void GLContextGetDefault( GLBlendEnableSRGB_t *dst )
|
||||
|
@ -37,7 +37,7 @@ bool g_bUsePseudoBufs = false; //( Plat_GetCommandLineA() ) ? ( strstr( Plat_Get
|
||||
// Significant perf degradation on some OSX parts if static buffers not disabled
|
||||
bool g_bDisableStaticBuffer = true;
|
||||
#else
|
||||
bool g_bDisableStaticBuffer = false; //( Plat_GetCommandLineA() ) ? ( strstr( Plat_GetCommandLineA(), "-gl_disable_static_buffer" ) != NULL ) : false;
|
||||
bool g_bDisableStaticBuffer = true; //( Plat_GetCommandLineA() ) ? ( strstr( Plat_GetCommandLineA(), "-gl_disable_static_buffer" ) != NULL ) : false;
|
||||
#endif
|
||||
|
||||
// http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt
|
||||
@ -93,8 +93,8 @@ CPersistentBuffer::~CPersistentBuffer()
|
||||
|
||||
void CPersistentBuffer::Init( EGLMBufferType type,uint nSize )
|
||||
{
|
||||
Assert( gGL->m_bHave_GL_EXT_buffer_storage );
|
||||
Assert( gGL->m_bHave_GL_ARB_map_buffer_range );
|
||||
// Assert( gGL->m_bHave_GL_EXT_buffer_storage );
|
||||
// Assert( gGL->m_bHave_GL_ARB_map_buffer_range );
|
||||
|
||||
m_nSize = nSize;
|
||||
m_nOffset = 0;
|
||||
@ -527,13 +527,13 @@ CGLMBuffer::CGLMBuffer( GLMContext *pCtx, EGLMBufferType type, uint size, uint o
|
||||
// buffers start out static, but if they get orphaned and gl_bufmode is non zero,
|
||||
// then they will get flipped to dynamic.
|
||||
|
||||
GLenum hint = GL_STATIC_DRAW;
|
||||
GLenum hint = GL_STREAM_DRAW;
|
||||
switch (m_type)
|
||||
{
|
||||
case kGLMVertexBuffer: hint = m_bDynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; break;
|
||||
case kGLMIndexBuffer: hint = m_bDynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; break;
|
||||
case kGLMVertexBuffer: hint = m_bDynamic ? GL_DYNAMIC_DRAW : GL_STREAM_DRAW; break;
|
||||
case kGLMIndexBuffer: hint = m_bDynamic ? GL_DYNAMIC_DRAW : GL_STREAM_DRAW; break;
|
||||
case kGLMUniformBuffer: hint = GL_DYNAMIC_DRAW; break;
|
||||
case kGLMPixelBuffer: hint = m_bDynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW; break;
|
||||
case kGLMPixelBuffer: hint = m_bDynamic ? GL_DYNAMIC_DRAW : GL_STREAM_DRAW; break;
|
||||
|
||||
default: Assert(!"Unknown buffer type" ); DXABSTRACT_BREAK_ON_ERROR();
|
||||
}
|
||||
@ -786,7 +786,7 @@ void CGLMBuffer::Lock( GLMBuffLockParams *pParams, char **pAddressOut )
|
||||
|
||||
// observe gl_bufmode on any orphan event.
|
||||
// if orphaned and bufmode is nonzero, flip it to dynamic.
|
||||
GLenum hint = gl_bufmode.GetInt() ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
|
||||
GLenum hint = gl_bufmode.GetInt() ? GL_DYNAMIC_DRAW : GL_STREAM_DRAW;
|
||||
gGL->glBufferData( m_buffGLTarget, m_nSize, (const GLvoid*)NULL, hint );
|
||||
|
||||
m_nRevision++; // revision grows on orphan event
|
||||
@ -829,7 +829,7 @@ void CGLMBuffer::Lock( GLMBuffLockParams *pParams, char **pAddressOut )
|
||||
// if orphaned and bufmode is nonzero, flip it to dynamic.
|
||||
|
||||
// We always want to call glBufferData( ..., NULL ) on discards, even though we're using the GL_MAP_INVALIDATE_BUFFER_BIT flag, because this flag is actually only a hint according to AMD.
|
||||
GLenum hint = gl_bufmode.GetInt() ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
|
||||
GLenum hint = gl_bufmode.GetInt() ? GL_DYNAMIC_DRAW : GL_STREAM_DRAW;
|
||||
gGL->glBufferData( m_buffGLTarget, m_nSize, (const GLvoid*)NULL, hint );
|
||||
|
||||
m_nRevision++; // revision grows on orphan event
|
||||
|
@ -362,8 +362,8 @@ void CGLMProgram::Compile( EGLMProgramLang lang )
|
||||
|
||||
GLchar log[4096];
|
||||
gGL->glGetShaderInfoLog( glslDesc->m_object.glsl, sizeof(log), &maxLength, log );
|
||||
printf("shader compile log: %s\n", log);
|
||||
printf("Shader %d source is:\n===============\n%s\nn===============\n", glslDesc->m_object.glsl, section);
|
||||
Msg("shader compile log: %s\n", log);
|
||||
Msg("Shader %d source is:\n===============\n%s\nn===============\n", glslDesc->m_object.glsl, section);
|
||||
}
|
||||
|
||||
#if 0 //GLM_FREE_SHADER_TEXT
|
||||
@ -785,8 +785,6 @@ bool CGLMShaderPair::ValidateProgramPair()
|
||||
{
|
||||
gGL->glUseProgram( m_program );
|
||||
|
||||
printf("Sample text\n");
|
||||
|
||||
m_ctx->NewLinkedProgram();
|
||||
|
||||
m_locVertexParams = gGL->glGetUniformLocation( m_program, "vc" );
|
||||
|
@ -163,7 +163,7 @@ void CGLMQuery::Start( void ) // "start counting"
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL->glBeginQuery( GL_SAMPLES_PASSED, m_name );
|
||||
gGL->glBeginQuery( GL_ANY_SAMPLES_PASSED, m_name );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -204,7 +204,7 @@ void CGLMQuery::Stop( void ) // "stop counting"
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL->glEndQuery( GL_SAMPLES_PASSED ); // we are only putting the request-to-stop-counting into the cmd stream.
|
||||
gGL->glEndQuery( GL_ANY_SAMPLES_PASSED ); // we are only putting the request-to-stop-counting into the cmd stream.
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1106,6 +1106,8 @@ void CGLMTex::CalcTexelDataOffsetAndStrides( int sliceIndex, int x, int y, int z
|
||||
*zStrideOut = zStride;
|
||||
}
|
||||
|
||||
extern void convert_texture( GLint &internalformat, GLsizei width, GLsizei height, GLenum &format, GLenum &type, void *data );
|
||||
|
||||
void CGLMTex::ReadTexels( GLMTexLockDesc *desc, bool readWholeSlice )
|
||||
{
|
||||
GLMRegion readBox;
|
||||
@ -1177,26 +1179,24 @@ void CGLMTex::ReadTexels( GLMTexLockDesc *desc, bool readWholeSlice )
|
||||
gGL->glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
gGL->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_ctx->m_samplers[0].m_pBoundTex->m_texName, 0);
|
||||
|
||||
uint fmt = format->m_glDataFormat;
|
||||
GLenum fmt = format->m_glDataFormat;
|
||||
if( fmt == GL_BGR )
|
||||
fmt = GL_RGB;
|
||||
else if( fmt == GL_BGRA )
|
||||
fmt = GL_RGBA;
|
||||
|
||||
gGL->glReadPixels(0, 0, m_layout->m_slices[ desc->m_sliceIndex ].m_xSize, m_layout->m_slices[ desc->m_sliceIndex ].m_ySize, fmt , format->m_glDataType == GL_UNSIGNED_INT_8_8_8_8_REV ? GL_UNSIGNED_BYTE : format->m_glDataType, sliceAddress);
|
||||
gGL->glReadPixels(0, 0, m_layout->m_slices[ desc->m_sliceIndex ].m_xSize, m_layout->m_slices[ desc->m_sliceIndex ].m_ySize, fmt, format->m_glDataType == GL_UNSIGNED_INT_8_8_8_8_REV ? GL_UNSIGNED_BYTE : format->m_glDataType, sliceAddress);
|
||||
GLint intformat = format->m_glDataFormat;
|
||||
GLenum _format = format->m_glDataFormat;
|
||||
GLenum _type = format->m_glDataType;
|
||||
|
||||
// TODO(nillerusr): Don't convert, should change m_format to another one
|
||||
convert_texture(intformat, m_layout->m_slices[ desc->m_sliceIndex ].m_xSize, m_layout->m_slices[ desc->m_sliceIndex ].m_ySize, _format, _type, sliceAddress);
|
||||
|
||||
gGL->glBindFramebuffer(GL_READ_FRAMEBUFFER, Rfbo);
|
||||
gGL->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, Dfbo);
|
||||
|
||||
gGL->glDeleteFramebuffers(1, &fbo);
|
||||
|
||||
#if 0
|
||||
gGL->glGetTexImage( target, // target
|
||||
desc->m_req.m_mip, // level
|
||||
format->m_glDataFormat, // dataformat
|
||||
format->m_glDataType, // datatype
|
||||
sliceAddress ); // destination
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3258,7 +3258,6 @@ const char *get_enum_str(uint val)
|
||||
if( g_glEnums[i].value == val )
|
||||
return g_glEnums[i].str;
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
@ -3301,56 +3300,99 @@ static inline float float_h2f(halffloat_t t)
|
||||
return tmp.f;
|
||||
}
|
||||
|
||||
void TexImage2D(GLenum target,
|
||||
GLint level,
|
||||
GLint internalformat,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLint border,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const void * data)
|
||||
static inline halffloat_t float_f2h(float f)
|
||||
{
|
||||
if( type == GL_UNSIGNED_INT_8_8_8_8_REV )
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
fullfloat_t tmp;
|
||||
halffloat_t ret;
|
||||
tmp.f = f;
|
||||
ret.x.sign = tmp.x.sign;
|
||||
if (tmp.x.exp == 0) {
|
||||
// O and denormal
|
||||
ret.bin = 0;
|
||||
} else if (tmp.x.exp==255) {
|
||||
// Inf / NaN
|
||||
ret.x.exp = 31;
|
||||
ret.x.mant = tmp.x.mant>>13;
|
||||
} else if(tmp.x.exp>0x71) {
|
||||
// flush to 0
|
||||
ret.x.exp = 0;
|
||||
ret.x.mant = 0;
|
||||
} else if(tmp.x.exp<0x8e) {
|
||||
// clamp to max
|
||||
ret.x.exp = 30;
|
||||
ret.x.mant = 1023;
|
||||
} else {
|
||||
ret.x.exp = tmp.x.exp - 38;
|
||||
ret.x.mant = tmp.x.mant>>13;
|
||||
}
|
||||
|
||||
if( format == GL_BGR )
|
||||
format = GL_RGB;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if( format == GL_BGRA )
|
||||
format = GL_RGBA;
|
||||
static uint8_t srgb_table[256] = {0};
|
||||
void pixel_srgb_inplace(GLvoid* pixels, GLuint size, GLuint width, GLuint height)
|
||||
{
|
||||
// return;
|
||||
if(!srgb_table[255]) {
|
||||
// create table
|
||||
for (int i=1; i<256; ++i) {
|
||||
srgb_table[i] = floorf(255.f*powf(i/255.f, 2.2f)+0.5f);
|
||||
}
|
||||
}
|
||||
uint8_t *data = (uint8_t*)pixels;
|
||||
int sz = width*height*size;
|
||||
for (int i=0; i < sz; i += size)
|
||||
{
|
||||
data[i] = srgb_table[data[i]];
|
||||
data[i+1] = srgb_table[data[i+1]];
|
||||
data[i+2] = srgb_table[data[i+2]];
|
||||
}
|
||||
}
|
||||
|
||||
if( internalformat == GL_SRGB8 && format == GL_RGBA )
|
||||
|
||||
|
||||
void convert_texture( GLint &internalformat, GLsizei width, GLsizei height, GLenum &format, GLenum &type, void *data )
|
||||
{
|
||||
// printf("internalformat=%s format=%s type=%s\n", get_enum_str(internalformat), get_enum_str(format), get_enum_str(type));
|
||||
|
||||
if( internalformat == GL_SRGB8 && (format == GL_RGBA || format == GL_BGRA ))
|
||||
internalformat = GL_SRGB8_ALPHA8;
|
||||
|
||||
if( format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA )
|
||||
internalformat = format;
|
||||
|
||||
#if 0
|
||||
if( internalformat == GL_SRGB8 )
|
||||
internalformat = GL_RGB;
|
||||
if( internalformat == GL_SRGB8_ALPHA8 )
|
||||
internalformat = GL_RGBA;*/
|
||||
// if( internalformat == GL_SRGB8_ALPHA8 )
|
||||
// internalformat = GL_RGBA;
|
||||
|
||||
// if( internalformat == GL_SRGB8 )
|
||||
// internalformat = GL_RGB;
|
||||
|
||||
if( data )
|
||||
{
|
||||
if( internalformat == GL_RGBA16F )
|
||||
{
|
||||
uint16_t *_data = (uint16_t*)data;
|
||||
uint8_t *new_data = (uint8_t*)data;
|
||||
uint8_t *_data = (uint8_t*)data;
|
||||
|
||||
if( format == GL_BGR )
|
||||
{
|
||||
for( int i = 0; i < width*height*3; i+=3 )
|
||||
{
|
||||
uint8_t tmp = _data[i];
|
||||
_data[i] = _data[i+2];
|
||||
_data[i+2] = tmp;
|
||||
}
|
||||
format = GL_RGB;
|
||||
}
|
||||
else if( format == GL_BGRA )
|
||||
{
|
||||
for( int i = 0; i < width*height*4; i+=4 )
|
||||
{
|
||||
halffloat_t fl;
|
||||
fl.bin = _data[i]; new_data[i] = float_h2f(fl)*255;
|
||||
fl.bin = _data[i+1]; new_data[i+1] = float_h2f(fl)*255;
|
||||
fl.bin = _data[i+2]; new_data[i+2] = float_h2f(fl)*255;
|
||||
fl.bin = _data[i+3]; new_data[i+3] = float_h2f(fl)*255;
|
||||
uint8_t tmp = _data[i];
|
||||
_data[i] = _data[i+2];
|
||||
_data[i+2] = tmp;
|
||||
}
|
||||
internalformat = GL_RGBA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
format = GL_RGBA;
|
||||
}
|
||||
else if( internalformat == GL_RGBA16 )
|
||||
|
||||
if( internalformat == GL_RGBA16 && !gGL->m_bHave_GL_EXT_texture_norm16 )
|
||||
{
|
||||
uint16_t *_data = (uint16_t*)data;
|
||||
uint8_t *new_data = (uint8_t*)data;
|
||||
@ -3363,12 +3405,54 @@ void TexImage2D(GLenum target,
|
||||
new_data[i+3] = _data[i+3] >> 8;
|
||||
}
|
||||
|
||||
data = new_data;
|
||||
internalformat = GL_RGBA;
|
||||
format = GL_RGBA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
else if( internalformat == GL_SRGB8_ALPHA8 )
|
||||
{
|
||||
// pixel_srgb_inplace( data, 4, width, height );
|
||||
internalformat = GL_RGBA;
|
||||
}
|
||||
else if( internalformat == GL_SRGB8 )
|
||||
{
|
||||
// pixel_srgb_inplace( data, 3, width, height );
|
||||
internalformat = GL_RGB;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if( format == GL_BGR )
|
||||
format = GL_RGB;
|
||||
else if( format == GL_BGRA )
|
||||
format = GL_RGBA;
|
||||
|
||||
if( internalformat == GL_RGBA16 && !gGL->m_bHave_GL_EXT_texture_norm16 )
|
||||
{
|
||||
internalformat = GL_RGBA;
|
||||
format = GL_RGBA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( type == GL_UNSIGNED_INT_8_8_8_8_REV )
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
|
||||
// printf("internalformat=%s format=%s type=%s\n==========================================\n", get_enum_str(internalformat), get_enum_str(format), get_enum_str(type));
|
||||
}
|
||||
|
||||
void TexImage2D(GLenum target,
|
||||
GLint level,
|
||||
GLint internalformat,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLint border,
|
||||
GLenum format,
|
||||
GLenum type,
|
||||
const void * data)
|
||||
{
|
||||
convert_texture( internalformat, width, height, format, type, data );
|
||||
|
||||
gGL->glTexImage2D(target, level, internalformat, width, height, border, format, type, data);
|
||||
}
|
||||
@ -3501,10 +3585,28 @@ void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||
if( srgb )
|
||||
intformat = GL_SRGB8_ALPHA8;
|
||||
}
|
||||
//gGL->glTexImage2D(target, 0, internalformat, width, height, border, format, type, data);
|
||||
|
||||
TexImage2D( target, level, intformat, width, height, border, format, type, pixels );
|
||||
gGL->glTexImage2D(target, level, intformat, width, height, border, format, type, pixels);
|
||||
//TexImage2D( target, level, intformat, width, height, border, format, type, pixels );
|
||||
if( data != pixels )
|
||||
free(pixels);
|
||||
}
|
||||
|
||||
void TexSubImage2D( GLenum target,
|
||||
GLint level,
|
||||
GLint xoffset,
|
||||
GLint yoffset,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLenum format,
|
||||
GLint internalformat,
|
||||
GLenum type,
|
||||
const void * data)
|
||||
{
|
||||
convert_texture( internalformat, width, height, format, type, data );
|
||||
gGL->glTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, data);
|
||||
}
|
||||
|
||||
// TexSubImage should work properly on every driver stack and GPU--enabling by default.
|
||||
ConVar gl_enabletexsubimage( "gl_enabletexsubimage", "1" );
|
||||
|
||||
@ -3562,10 +3664,10 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
|
||||
|
||||
// allow use of subimage if the target is texture2D and it has already been teximage'd
|
||||
bool mayUseSubImage = false;
|
||||
//if ( (target==GL_TEXTURE_2D) && (m_sliceFlags[ desc->m_sliceIndex ] & kSliceValid) )
|
||||
//{
|
||||
// mayUseSubImage = gl_enabletexsubimage.GetInt() != 0;
|
||||
//}
|
||||
if ( (target==GL_TEXTURE_2D) && (m_sliceFlags[ desc->m_sliceIndex ] & kSliceValid) )
|
||||
{
|
||||
// mayUseSubImage = gl_enabletexsubimage.GetInt() != 0;
|
||||
}
|
||||
|
||||
// check flavor, 2D, 3D, or cube map
|
||||
// we also have the choice to use subimage if this is a tex already created. (open question as to benefit)
|
||||
@ -3681,54 +3783,28 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
|
||||
{
|
||||
// go subimage2D if it's a replacement, not a creation
|
||||
|
||||
|
||||
gGL->glPixelStorei( GL_UNPACK_ROW_LENGTH, slice->m_xSize ); // in pixels
|
||||
gGL->glPixelStorei( GL_UNPACK_SKIP_PIXELS, writeBox.xmin ); // in pixels
|
||||
gGL->glPixelStorei( GL_UNPACK_SKIP_ROWS, writeBox.ymin ); // in pixels
|
||||
|
||||
gGL->glTexSubImage2D( glDataFormat,
|
||||
TexSubImage2D( target,
|
||||
desc->m_req.m_mip, // level
|
||||
writeBox.xmin, // xoffset into dest
|
||||
writeBox.ymin, // yoffset into dest
|
||||
writeBox.xmax - writeBox.xmin, // width (was slice->m_xSize)
|
||||
writeBox.ymax - writeBox.ymin, // height (was slice->m_ySize)
|
||||
glDataFormat, // format
|
||||
glDataType == GL_UNSIGNED_INT_8_8_8_8_REV ? GL_UNSIGNED_BYTE : glDataType, // type
|
||||
intformat,
|
||||
glDataType, // type
|
||||
sliceAddress // data (will be offsetted by the SKIP_PIXELS and SKIP_ROWS - let GL do the math to find the first source texel)
|
||||
);
|
||||
|
||||
gGL->glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
|
||||
gGL->glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
|
||||
gGL->glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
|
||||
|
||||
/*
|
||||
//http://www.opengl.org/sdk/docs/man/xhtml/glTexSubImage2D.xml
|
||||
glTexSubImage2D( target,
|
||||
desc->m_req.m_mip, // level
|
||||
0, // xoffset
|
||||
0, // yoffset
|
||||
slice->m_xSize, // width
|
||||
slice->m_ySize, // height
|
||||
glDataFormat, // format
|
||||
glDataType, // type
|
||||
sliceAddress // data
|
||||
);
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_layout->m_key.m_texFlags & kGLMTexRenderable)
|
||||
{
|
||||
if (gl_rt_forcergba.GetInt())
|
||||
{
|
||||
if (glDataFormat == GL_BGRA)
|
||||
{
|
||||
// change it
|
||||
glDataFormat = GL_RGBA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// uncompressed path
|
||||
// http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html
|
||||
TexImage2D( target, // target
|
||||
|
@ -1381,7 +1381,7 @@ void D3DToGL::PrintParameterToString ( uint32 dwToken, uint32 dwSourceOrDest, ch
|
||||
case D3DSRO_FOG:
|
||||
if( !m_bFogFragCoord )
|
||||
{
|
||||
StrcatToHeaderCode("varying mediump vec4 _gl_FogFragCoord;\n");
|
||||
StrcatToHeaderCode("varying highp vec4 _gl_FogFragCoord;\n");
|
||||
m_bFogFragCoord = true;
|
||||
}
|
||||
|
||||
@ -1403,7 +1403,7 @@ void D3DToGL::PrintParameterToString ( uint32 dwToken, uint32 dwSourceOrDest, ch
|
||||
{
|
||||
if( !m_bFrontColor )
|
||||
{
|
||||
StrcatToHeaderCode("varying lowp vec4 _gl_FrontColor;\n");
|
||||
StrcatToHeaderCode("varying highp vec4 _gl_FrontColor;\n");
|
||||
m_bFrontColor = true;
|
||||
}
|
||||
|
||||
@ -1413,7 +1413,7 @@ void D3DToGL::PrintParameterToString ( uint32 dwToken, uint32 dwSourceOrDest, ch
|
||||
{
|
||||
if( !m_bFrontSecondaryColor )
|
||||
{
|
||||
StrcatToHeaderCode("varying lowp vec4 _gl_FrontSecondaryColor;\n");
|
||||
StrcatToHeaderCode("varying highp vec4 _gl_FrontSecondaryColor;\n");
|
||||
m_bFrontSecondaryColor = true;
|
||||
}
|
||||
|
||||
@ -2545,14 +2545,14 @@ void D3DToGL::Handle_TEX( uint32 dwToken, bool bIsTexLDL )
|
||||
V_snprintf( szExtra, sizeof( szExtra ), ".%c", GetSwizzleComponent( pSrc0Reg, 3 ) );
|
||||
V_strncat( szLOD, szExtra, sizeof( szLOD ) );
|
||||
|
||||
PrintToBufWithIndents( *m_pBufALUCode, "%s = %s( %s, %s, %s );\n", pDestReg, bIsShadowSampler ? "shadow2DLod" : "textureLod", pSrc1Reg, sCoordVar.String(), szLOD );
|
||||
PrintToBufWithIndents( *m_pBufALUCode, "%s = %s( %s, %s, %s );\n", pDestReg, "textureLod", pSrc1Reg, sCoordVar.String(), szLOD );
|
||||
}
|
||||
else if ( bIsShadowSampler )
|
||||
{
|
||||
// .z is meant to contain the object depth, while .xy contains the 2D tex coords
|
||||
CUtlString sCoordVar3D = EnsureNumSwizzleComponents( pSrc0Reg, 3 );
|
||||
|
||||
PrintToBufWithIndents( *m_pBufALUCode, "%s = shadow2D( %s, %s );\n", pDestReg, pSrc1Reg, sCoordVar3D.String() );
|
||||
PrintToBufWithIndents( *m_pBufALUCode, "%s = vec4(texture( %s, %s ));\n", pDestReg, pSrc1Reg, sCoordVar3D.String() );
|
||||
Assert( m_dwSamplerTypes[dwSrc1Token & D3DSP_REGNUM_MASK] == SAMPLER_TYPE_2D );
|
||||
}
|
||||
else if( ( OpcodeSpecificData( dwToken ) << D3DSP_OPCODESPECIFICCONTROL_SHIFT ) == D3DSI_TEXLD_PROJECT )
|
||||
@ -2934,13 +2934,19 @@ void D3DToGL::WriteGLSLSamplerDefinitions()
|
||||
{
|
||||
int nSamplersWritten = 0;
|
||||
bool m_bSampler3d = false;
|
||||
bool m_bShadowSampler = false;
|
||||
for ( int i=0; i < ARRAYSIZE( m_dwSamplerTypes ); i++ )
|
||||
{
|
||||
if ( m_dwSamplerTypes[i] == SAMPLER_TYPE_2D )
|
||||
{
|
||||
if ( ( ( 1 << i ) & m_nShadowDepthSamplerMask ) != 0 )
|
||||
{
|
||||
PrintToBuf( *m_pBufHeaderCode, "uniform sampler2D sampler%d;\n", i );
|
||||
if( !m_bShadowSampler )
|
||||
{
|
||||
PrintToBuf( *m_pBufHeaderCode, "precision lowp sampler2DShadow;\n", i );
|
||||
m_bShadowSampler = true;
|
||||
}
|
||||
PrintToBuf( *m_pBufHeaderCode, "uniform sampler2DShadow sampler%d;\n", i );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2955,7 +2961,6 @@ void D3DToGL::WriteGLSLSamplerDefinitions()
|
||||
StrcatToHeaderCode( "precision mediump sampler3D;\n" );
|
||||
m_bSampler3d = true;
|
||||
}
|
||||
|
||||
PrintToBuf( *m_pBufHeaderCode, "uniform sampler3D sampler%d;\n", i );
|
||||
++nSamplersWritten;
|
||||
}
|
||||
@ -3006,7 +3011,7 @@ void D3DToGL::WriteGLSLOutputVariableAssignments()
|
||||
{
|
||||
if( !m_bFrontColor )
|
||||
{
|
||||
StrcatToHeaderCode("varying lowp vec4 _gl_FrontColor;\n");
|
||||
StrcatToHeaderCode("varying highp vec4 _gl_FrontColor;\n");
|
||||
m_bFrontColor = true;
|
||||
}
|
||||
|
||||
@ -3181,9 +3186,9 @@ int D3DToGL::TranslateShader( uint32* code, CUtlBuffer *pBufDisassembledCode, bo
|
||||
m_bPutHexCodesAfterLines = (options & D3DToGL_PutHexCommentsAfterLines) != 0;
|
||||
m_bGeneratingDebugText = (options & D3DToGL_GeneratingDebugText) != 0;
|
||||
m_bGenerateSRGBWriteSuffix = (options & D3DToGL_OptionSRGBWriteSuffix) != 0;
|
||||
// m_bGenerateSRGBWriteSuffix = true;
|
||||
m_bGenerateSRGBWriteSuffix = false;
|
||||
|
||||
if( debugLabel && ( V_strstr( debugLabel ,"vertexlit_and_unlit_generic_bump_ps") ))
|
||||
if( debugLabel && (V_strstr( debugLabel ,"vertexlit_and_unlit_generic_ps") || V_strstr( debugLabel ,"vertexlit_and_unlit_generic_bump_ps") ) )
|
||||
m_bGenerateSRGBWriteSuffix = true;
|
||||
|
||||
m_NumIndentTabs = 1; // start code indented one tab
|
||||
@ -3277,13 +3282,13 @@ int D3DToGL::TranslateShader( uint32* code, CUtlBuffer *pBufDisassembledCode, bo
|
||||
if ( ( dwToken & 0xFFFF0000 ) == 0xFFFF0000 )
|
||||
{
|
||||
// must explicitly enable extensions if emitting GLSL
|
||||
V_snprintf( (char *)m_pBufHeaderCode->Base(), m_pBufHeaderCode->Size(), "#version 300 es\nprecision mediump float;\n#define varying in\n\n%s", glslExtText );
|
||||
V_snprintf( (char *)m_pBufHeaderCode->Base(), m_pBufHeaderCode->Size(), "#version 300 es\nprecision highp float;\n#define varying in\n\n%s", glslExtText );
|
||||
m_bVertexShader = false;
|
||||
}
|
||||
else // vertex shader
|
||||
{
|
||||
m_bGenerateSRGBWriteSuffix = false;
|
||||
V_snprintf( (char *)m_pBufHeaderCode->Base(), m_pBufHeaderCode->Size(), "#version 300 es\nprecision mediump float;\n#define attribute in\n#define varying out\n%s//ATTRIBMAP-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx\n", glslExtText );
|
||||
V_snprintf( (char *)m_pBufHeaderCode->Base(), m_pBufHeaderCode->Size(), "#version 300 es\nprecision highp float;\n#define attribute in\n#define varying out\n%s//ATTRIBMAP-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx-xx\n", glslExtText );
|
||||
|
||||
// find that first '-xx' which is where the attrib map will be written later.
|
||||
pAttribMapStart = strstr( (char *)m_pBufHeaderCode->Base(), "-xx" ) + 1;
|
||||
@ -3889,13 +3894,14 @@ int D3DToGL::TranslateShader( uint32* code, CUtlBuffer *pBufDisassembledCode, bo
|
||||
|
||||
#define FindSubcode(a) (V_strstr((char*)m_pBufALUCode->Base(), a) != 0 || V_strstr((char*)m_pBufHeaderCode->Base(), a) != 0 || V_strstr((char*)m_pBufParamCode->Base(), a) != 0 || V_strstr((char*)m_pBufAttribCode->Base(), a) != 0 )
|
||||
|
||||
/*
|
||||
if( FindSubcode("shadow2DProj") )
|
||||
{
|
||||
StrcatToHeaderCode( g_szShadow2D );
|
||||
StrcatToHeaderCode( g_szShadow2DProj );
|
||||
}
|
||||
else if( FindSubcode("shadow2D") )
|
||||
StrcatToHeaderCode( g_szShadow2D );
|
||||
StrcatToHeaderCode( g_szShadow2D );*/
|
||||
|
||||
if( FindSubcode("_gl_FrontColor") && !m_bFrontColor )
|
||||
StrcatToHeaderCode( "in vec4 _gl_FrontColor;\n" );
|
||||
|
@ -1201,8 +1201,8 @@ static void FillD3DCaps9( const GLMRendererInfoFields &glmRendererInfo, D3DCAPS9
|
||||
pCaps->MaxPixelShader30InstructionSlots = 0;
|
||||
|
||||
#if DX_TO_GL_ABSTRACTION
|
||||
pCaps->FakeSRGBWrite = true;//!glmRendererInfo.m_hasGammaWrites;
|
||||
pCaps->CanDoSRGBReadFromRTs = true;//!glmRendererInfo.m_cantAttachSRGB;
|
||||
pCaps->FakeSRGBWrite = !glmRendererInfo.m_hasGammaWrites;
|
||||
pCaps->CanDoSRGBReadFromRTs = !glmRendererInfo.m_cantAttachSRGB;
|
||||
pCaps->MixedSizeTargets = glmRendererInfo.m_hasMixedAttachmentSizes;
|
||||
#endif
|
||||
}
|
||||
|
@ -333,6 +333,9 @@ static bool CheckOpenGLExtension(const char *ext, const int coremajor, const int
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern bool g_bUsePseudoBufs;
|
||||
extern bool g_bDisableStaticBuffer;
|
||||
|
||||
// The GL context you want entry points for must be current when you hit this constructor!
|
||||
COpenGLEntryPoints::COpenGLEntryPoints()
|
||||
: m_nTotalGLCycles(0)
|
||||
@ -387,17 +390,24 @@ COpenGLEntryPoints::COpenGLEntryPoints()
|
||||
{
|
||||
m_bHave_GL_EXT_framebuffer_object = true;
|
||||
m_bHave_GL_EXT_framebuffer_blit = true;
|
||||
m_bHave_GL_EXT_framebuffer_multisample = true;
|
||||
m_bHave_GL_ARB_occlusion_query = true;
|
||||
m_bHave_GL_ARB_map_buffer_range = true;
|
||||
m_bHave_GL_ARB_vertex_buffer_object = true;
|
||||
m_bHave_GL_ARB_vertex_array_bgra = true;
|
||||
m_bHave_GL_EXT_vertex_array_bgra = true;
|
||||
m_bHave_GL_ARB_debug_output = true;
|
||||
m_bHave_GL_EXT_direct_state_access = false;
|
||||
m_bHave_GL_EXT_framebuffer_multisample_blit_scaled = true;
|
||||
m_bHave_GL_EXT_texture_sRGB_decode = true;
|
||||
m_bHave_GL_ARB_occlusion_query = true;
|
||||
m_bHave_GL_EXT_buffer_storage = false;
|
||||
m_bHave_GL_ARB_vertex_buffer_object = true;
|
||||
m_bHave_GL_ARB_debug_output = true;
|
||||
m_bHave_GL_ARB_sync = true;
|
||||
|
||||
// m_bHave_GL_EXT_texture_sRGB_decode = true;
|
||||
|
||||
if( CommandLine()->FindParm( "-gl_enable_pseudobufs" ) )
|
||||
g_bUsePseudoBufs = true;
|
||||
if( CommandLine()->FindParm( "-gl_enable_static_buffer" ) )
|
||||
g_bDisableStaticBuffer = false;
|
||||
if( CommandLine()->FindParm( "-gl_enable_buffer_storage" ) )
|
||||
m_bHave_GL_EXT_buffer_storage = true;
|
||||
|
||||
#if 0
|
||||
glBindFramebuffer.Force(glBindFramebuffer.Pointer());
|
||||
glBindRenderbuffer.Force(glBindRenderbuffer.Pointer());
|
||||
glCheckFramebufferStatus.Force(glCheckFramebufferStatus.Pointer());
|
||||
@ -410,6 +420,7 @@ COpenGLEntryPoints::COpenGLEntryPoints()
|
||||
glDeleteFramebuffers.Force(glDeleteFramebuffers.Pointer());
|
||||
glBlitFramebuffer.Force(glBlitFramebuffer.Pointer());
|
||||
glRenderbufferStorageMultisample.Force(glRenderbufferStorageMultisample.Pointer());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DEBUG_ALL_GLCALLS
|
||||
@ -417,10 +428,10 @@ COpenGLEntryPoints::COpenGLEntryPoints()
|
||||
#define GL_EXT(x,glmajor,glminor)
|
||||
#define GL_FUNC(ext,req,ret,fn,arg,call) \
|
||||
fn##_gldebugptr = this->fn; \
|
||||
this->fn.Force(fn##_gldebug);
|
||||
// this->fn.Force(fn##_gldebug);
|
||||
#define GL_FUNC_VOID(ext,req,fn,arg,call) \
|
||||
fn##_gldebugptr = this->fn; \
|
||||
this->fn.Force(fn##_gldebug);
|
||||
// this->fn.Force(fn##_gldebug);
|
||||
#include "togles/glfuncs.inl"
|
||||
#undef GL_FUNC_VOID
|
||||
#undef GL_FUNC
|
||||
@ -434,6 +445,7 @@ COpenGLEntryPoints::COpenGLEntryPoints()
|
||||
if ( ( m_bHave_GL_NV_bindless_texture ) && ( !CommandLine()->CheckParm( "-gl_nv_bindless_texturing" ) ) )
|
||||
{
|
||||
m_bHave_GL_NV_bindless_texture = false;
|
||||
#if 0
|
||||
glGetTextureHandleNV.Force( NULL );
|
||||
glGetTextureSamplerHandleNV.Force( NULL );
|
||||
glMakeTextureHandleResidentNV.Force( NULL );
|
||||
@ -443,6 +455,7 @@ COpenGLEntryPoints::COpenGLEntryPoints()
|
||||
glProgramUniformHandleui64NV.Force( NULL );
|
||||
glProgramUniformHandleui64vNV.Force( NULL );
|
||||
glIsTextureHandleResidentNV.Force( NULL );
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( !CommandLine()->CheckParm( "-gl_amd_pinned_memory" ) )
|
||||
@ -501,6 +514,3 @@ void COpenGLEntryPoints::ClearEntryPoints()
|
||||
}
|
||||
// Turn off memdbg macros (turned on up top) since this is included like a header
|
||||
#include "tier0/memdbgoff.h"
|
||||
|
||||
|
||||
|
||||
|
@ -229,7 +229,7 @@ void APIENTRY GL_Debug_Output_Callback(GLenum source, GLenum type, GLuint id, GL
|
||||
|
||||
if ( ( type == GL_DEBUG_TYPE_ERROR_ARB ) && ( g_bDebugOutputBreakpoints ) )
|
||||
{
|
||||
DebuggerBreak();
|
||||
// DebuggerBreak();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1323,7 +1323,7 @@ void GLMContext::BlitTex( CGLMTex *srcTex, GLMRect *srcRect, int srcFace, int sr
|
||||
attparams.m_zslice = 0;
|
||||
m_blitReadFBO->TexAttach( &attparams, attachIndex, GL_READ_FRAMEBUFFER );
|
||||
|
||||
gGL->glDrawBuffers( 1, &attachIndexGL );
|
||||
gGL->glReadBuffer( attachIndexGL );
|
||||
|
||||
// set the write fb and buffer, and attach write tex
|
||||
BindFBOToCtx( m_blitDrawFBO, GL_DRAW_FRAMEBUFFER );
|
||||
@ -2648,7 +2648,7 @@ GLMContext::GLMContext( IDirect3DDevice9 *pDevice, GLMDisplayParams *params )
|
||||
|
||||
gGL->glGenBuffers( 1, &m_destroyPBO );
|
||||
gGL->glBindBuffer( GL_PIXEL_UNPACK_BUFFER, m_destroyPBO );
|
||||
gGL->glBufferData( GL_PIXEL_UNPACK_BUFFER, sizeof( g_garbageTextureBits ), g_garbageTextureBits, GL_STATIC_DRAW );
|
||||
gGL->glBufferData( GL_PIXEL_UNPACK_BUFFER, sizeof( g_garbageTextureBits ), g_garbageTextureBits, GL_STREAM_DRAW );
|
||||
gGL->glBindBuffer( GL_PIXEL_UNPACK_BUFFER, m_nBoundGLBuffer[ kGLMPixelBuffer ] );
|
||||
|
||||
// Create a bunch of texture names for us to use forever and ever ramen.
|
||||
|
Loading…
Reference in New Issue
Block a user