osx : fix syscalls

This commit is contained in:
hymei
2022-06-05 01:13:13 +03:00
committed by nillerusr
parent c7308906d1
commit 3291cdf978
16 changed files with 92 additions and 32 deletions
+5 -4
View File
@@ -157,7 +157,8 @@ CGLMProgram::~CGLMProgram( )
GLMShaderDesc *glslDesc = &m_descs[kGLMGLSL];
if (glslDesc->m_object.glsl)
{
gGL->glDeleteShader( (uint)glslDesc->m_object.glsl ); // why do I need a cast here again ?
//gGL->glDeleteShader( (uint)glslDesc->m_object.glsl ); // why do I need a cast here again ?
gGL->glDeleteObjectARB( glslDesc->m_object.glsl ); // because you call the wrong api
glslDesc->m_object.glsl = 0;
}
@@ -814,7 +815,7 @@ void CGLMProgram::LogSlow( EGLMProgramLang lang )
m_type==kGLMVertexProgram ? "VS" : "FS",
this,
lang==kGLMGLSL ? "GLSL" : "ARB",
(int)(lang==kGLMGLSL ? (int)desc->m_object.glsl : (int)desc->m_object.arb),
(int)(lang==kGLMGLSL ? (intp)desc->m_object.glsl : (int)desc->m_object.arb),
m_text
);
#endif
@@ -828,7 +829,7 @@ void CGLMProgram::LogSlow( EGLMProgramLang lang )
m_type==kGLMVertexProgram ? "VS" : "FS",
this,
lang==kGLMGLSL ? "GLSL" : "ARB",
(int)(lang==kGLMGLSL ? (int)desc->m_object.glsl : (int)desc->m_object.arb),
(int)(lang==kGLMGLSL ? (intp)desc->m_object.glsl : (int)desc->m_object.arb),
desc->m_slowMark+1
);
}
@@ -984,7 +985,7 @@ bool CGLMShaderPair::ValidateProgramPair()
if (m_valid)
{
gGL->glUseProgram( m_program );
gGL->glUseProgramObjectARB( m_program );
m_ctx->NewLinkedProgram();
+19 -6
View File
@@ -670,7 +670,7 @@ void GLMContext::DumpCaps( void )
#define dumpfield_hex( fff ) printf( "\n %-30s : 0x%08x", #fff, (int) m_caps.fff )
#define dumpfield_str( fff ) printf( "\n %-30s : %s", #fff, m_caps.fff )
printf("\n-------------------------------- context caps for context %08x", (uint)this);
printf("\n-------------------------------- context caps for context %p", this);
dumpfield( m_fullscreen );
dumpfield( m_accelerated );
@@ -1745,8 +1745,9 @@ void GLMContext::PreloadTex( CGLMTex *tex, bool force )
}
}
gGL->glUseProgram( (GLuint)preloadPair->m_program );
gGL->glUseProgramObjectARB( preloadPair->m_program );
//gGL->glUseProgram( (GLuint)preloadPair->m_program );
m_pBoundPair = preloadPair;
m_bDirtyPrograms = true;
@@ -1793,7 +1794,7 @@ void GLMContext::PreloadTex( CGLMTex *tex, bool force )
gGL->glEnableVertexAttribArray( 0 );
gGL->glVertexAttribPointer( 0, 3, GL_FLOAT, 0, 0, posns );
gGL->glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), posns );
gGL->glDrawRangeElements( GL_TRIANGLES, 0, 2, 3, GL_UNSIGNED_SHORT, indices);
@@ -2701,6 +2702,10 @@ GLMContext::GLMContext( IDirect3DDevice9 *pDevice, GLMDisplayParams *params )
// debug state
m_debugFrameIndex = -1;
#if defined( OSX ) && defined( GLMDEBUG )
memset( m_boundProgram , 0, sizeof( m_boundProgram ) );
#endif
#if GLMDEBUG
// #######################################################################################
@@ -5202,11 +5207,11 @@ void GLMContext::DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsize
if ( pIndexBuf->m_bPseudo )
{
// you have to pass actual address, not offset
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_pPseudoBuf );
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_pPseudoBuf );
}
if (pIndexBuf->m_bUsingPersistentBuffer)
{
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_nPersistentBufferStartOffset );
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_nPersistentBufferStartOffset );
}
#if GLMDEBUG
@@ -5244,7 +5249,11 @@ void GLMContext::DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsize
}
else
{
#if defined( OSX )
// MoeMod: TOGL IS NOT USING m_boundProgram THIS AT ALL
#else
AssertOnce(!"drawing with no vertex program bound");
#endif
}
if (m_boundProgram[kGLMFragmentProgram])
@@ -5253,7 +5262,11 @@ void GLMContext::DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsize
}
else
{
#if defined( OSX )
// MoeMod: TOGL IS NOT USING m_boundProgram THIS AT ALL
#else
AssertOnce(!"drawing with no fragment program bound");
#endif
}
#endif
+3 -2
View File
@@ -196,7 +196,8 @@ FORCEINLINE void GLMContext::FlushDrawStates( uint nStartIndex, uint nEndIndex,
}
}
gGL->glUseProgram( (GLuint)pNewPair->m_program );
gGL->glUseProgramObjectARB(pNewPair->m_program);
//gGL->glUseProgram( (GLuint)pNewPair->m_program );
GL_BATCH_PERF( m_FlushStats.m_nTotalProgramPairChanges++; )
@@ -563,7 +564,7 @@ FORCEINLINE void GLMContext::FlushDrawStates( uint nStartIndex, uint nEndIndex,
SetBufAndVertexAttribPointer( nIndex, pBuf->GetHandle(),
pStream->m_stride, pDeclElem->m_gldecl.m_datatype, pDeclElem->m_gldecl.m_normalized, pDeclElem->m_gldecl.m_nCompCount,
reinterpret_cast< const GLvoid * >( reinterpret_cast< int >( pBuf->m_pPseudoBuf ) + nBufOffset ),
reinterpret_cast< const GLvoid * >( reinterpret_cast< intp >( pBuf->m_pPseudoBuf ) + nBufOffset ),
pBuf->m_nRevision );
if ( !( m_lastKnownVertexAttribMask & nMask ) )
+3 -1
View File
@@ -4243,7 +4243,9 @@ CGLMEditableTextItem::~CGLMEditableTextItem( )
if (m_mirror)
{
free( m_mirror );
//free( m_mirror );
// MoeMod : should be delete here
delete m_mirror;
}
}
+28 -1
View File
@@ -27,6 +27,9 @@
// memdbgon -must- be the last include file in a .cpp file.
#include "tier0/memdbgon.h"
// MoeMod : ARM Mac doesnt need this workround
#if (defined(__i386__) || defined(__x86_64__))
IntelGLMallocWorkaround* IntelGLMallocWorkaround::s_pWorkaround = NULL;
void *IntelGLMallocWorkaround::ZeroingAlloc(size_t size)
@@ -68,4 +71,28 @@ bool IntelGLMallocWorkaround::Enable()
}
return true;
}
}
#else
IntelGLMallocWorkaround* IntelGLMallocWorkaround::s_pWorkaround = NULL;
void *IntelGLMallocWorkaround::ZeroingAlloc(size_t size)
{
return nullptr;
}
IntelGLMallocWorkaround* IntelGLMallocWorkaround::Get()
{
if (!s_pWorkaround)
{
s_pWorkaround = new IntelGLMallocWorkaround();
}
return s_pWorkaround;
}
bool IntelGLMallocWorkaround::Enable()
{
return true;
}
#endif