Merge branch 'master' into windows

This commit is contained in:
HappyDOGE
2022-07-27 12:58:56 +03:00
3089 changed files with 38639 additions and 844820 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();
+15 -6
View File
@@ -2092,23 +2092,32 @@ static uint PrintDoubleInt( char *pBuf, uint nBufSize, double f, uint nMinChars
if ( bAnyDigitsLeft )
{
uint n = remainder % 100U; remainder /= 100U; *reinterpret_cast<uint16*>(pDst - 1) = reinterpret_cast<const uint16*>(pDigits)[n];
n = remainder % 100U; remainder /= 100U; *reinterpret_cast<uint16*>(pDst - 1 - 2) = reinterpret_cast<const uint16*>(pDigits)[n];
uint n = remainder % 100U; remainder /= 100U;
memcpy( reinterpret_cast<uint16*>(pDst - 1), &(reinterpret_cast<const uint16*>(pDigits)[n]), sizeof(uint16) );
n = remainder % 100U; remainder /= 100U;
memcpy( reinterpret_cast<uint16*>(pDst - 3), &(reinterpret_cast<const uint16*>(pDigits)[n]), sizeof(uint16) );
Assert( remainder < 100U );
*reinterpret_cast<uint16*>(pDst - 1 - 4) = reinterpret_cast<const uint16*>(pDigits)[remainder];
memcpy( reinterpret_cast<uint16*>(pDst - 5), &(reinterpret_cast<const uint16*>(pDigits)[remainder]), sizeof(uint16) );
pDst -= 6;
}
else
{
uint n = remainder % 100U; remainder /= 100U; *reinterpret_cast<uint16*>(pDst - 1) = reinterpret_cast<const uint16*>(pDigits)[n]; --pDst; if ( ( n >= 10 ) || ( remainder ) ) --pDst;
uint n = remainder % 100U; remainder /= 100U;
memcpy( reinterpret_cast<uint16*>(pDst - 1), &(reinterpret_cast<const uint16*>(pDigits)[n]), sizeof(uint16) );
--pDst; if ( ( n >= 10 ) || ( remainder ) ) --pDst;
if ( remainder )
{
n = remainder % 100U; remainder /= 100U; *reinterpret_cast<uint16*>(pDst - 1) = reinterpret_cast<const uint16*>(pDigits)[n]; --pDst; if ( ( n >= 10 ) || ( remainder ) ) --pDst;
n = remainder % 100U; remainder /= 100U;
memcpy( reinterpret_cast<uint16*>(pDst - 1), &(reinterpret_cast<const uint16*>(pDigits)[n]), sizeof(uint16) );
--pDst; if ( ( n >= 10 ) || ( remainder ) ) --pDst;
if ( remainder )
{
Assert( remainder < 100U );
*reinterpret_cast<uint16*>(pDst - 1) = reinterpret_cast<const uint16*>(pDigits)[remainder]; --pDst; if ( remainder >= 10 ) --pDst;
memcpy( reinterpret_cast<uint16*>(pDst - 1), &(reinterpret_cast<const uint16*>(pDigits)[remainder]), sizeof(uint16) );
--pDst; if ( remainder >= 10 ) --pDst;
}
}
}
+14 -10
View File
@@ -1876,7 +1876,7 @@ HRESULT IDirect3DQuery9::GetData(void* pData,DWORD dwSize,DWORD dwGetDataFlags)
GL_BATCH_PERF_CALL_TIMER;
Assert( m_device->m_nValidMarker == D3D_DEVICE_VALID_MARKER );
HRESULT result = S_FALSE ;
DWORD nCurThreadId = ThreadGetCurrentId();
uintp nCurThreadId = ThreadGetCurrentId();
// Make sure calling thread owns the GL context.
Assert( m_ctx->m_nCurOwnerThreadId == nCurThreadId );
@@ -3762,12 +3762,16 @@ static uint32 CentroidMaskFromName( bool bPixelShader, const char *pName )
static int ShadowDepthSamplerMaskFromName( const char *pName )
{
if ( !pName )
return 0;
return 0;
if ( V_stristr( pName, "water_ps" ) )
{
return (1<<7);
}
else if ( V_stristr( pName, "skin_ps" ) )
{
return (1<<4);
}
else if ( V_stristr( pName, "infected_ps" ) )
{
return (1<<1);
@@ -3794,7 +3798,7 @@ static int ShadowDepthSamplerMaskFromName( const char *pName )
}
else if ( V_stristr( pName, "worldtwotextureblend_ps" ) )
{
return (1<<7);
return (1<<2);
}
else if ( V_stristr( pName, "teeth_flashlight_ps" ) )
{
@@ -3811,27 +3815,27 @@ static int ShadowDepthSamplerMaskFromName( const char *pName )
else if ( V_stristr( pName, "deferred_global_light_ps" ) )
{
return (1<<14);
}
}
else if ( V_stristr( pName, "global_lit_simple_ps" ) )
{
return (1<<14);
}
}
else if ( V_stristr( pName, "lightshafts_ps" ) )
{
return (1<<1);
}
}
else if ( V_stristr( pName, "multiblend_combined_ps" ) )
{
return (1<<14);
}
}
else if ( V_stristr( pName, "multiblend_ps" ) )
{
return (1<<14);
}
}
else if ( V_stristr( pName, "customhero_ps" ) )
{
return (1<<14);
}
}
// This shader doesn't have a shadow depth map sampler
return 0;
+25 -12
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;
@@ -1788,14 +1789,14 @@ void GLMContext::PreloadTex( CGLMTex *tex, bool force )
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f };
static int indices[] = { 0, 1, 2 };
static short indices[] = { 0, 1, 2 };
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, 3, 3, GL_UNSIGNED_INT, indices);
gGL->glDrawRangeElements( GL_TRIANGLES, 0, 2, 3, GL_UNSIGNED_SHORT, indices);
gGL->glDisableVertexAttribArray( 0 );
@@ -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
// #######################################################################################
@@ -4649,14 +4654,14 @@ void GLMContext::GenDebugFontTex( void )
//-----------------------------------------------------
// fetch elements of font data and make texels... we're doing the whole slab so we don't really need the stride info
unsigned long *destTexelPtr = (unsigned long *)lockAddress;
uint32 *destTexelPtr = (uint32 *)lockAddress;
for( int index = 0; index < 16384; index++ )
{
if (g_glmDebugFontMap[index] == ' ')
{
// clear
*destTexelPtr = 0x00000000;
*destTexelPtr = 0;
}
else
{
@@ -5093,11 +5098,11 @@ void GLMContext::DrawRangeElementsNonInline( GLenum mode, GLuint start, GLuint e
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 GL_ENABLE_INDEX_VERIFICATION
@@ -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