This commit is contained in:
Riley Labrecque
2014-01-29 14:57:56 +02:00
parent 650c29b08a
commit ce35e1c4bd
55 changed files with 386 additions and 40 deletions
+1
View File
@@ -72,6 +72,7 @@ static GLenum EncodeAttachmentFBO( EGLMFBOAttachment index )
default:
GLMStop(); // bad news
return 0;
break;
}
}
+6 -3
View File
@@ -396,7 +396,7 @@ bool CGLMProgram::Compile( EGLMProgramLang lang )
GetComboIndexNameString( tempname, sizeof(tempname) );
printf("\ncompile: %s on GL name %d ", tempname, glslDesc->m_object.glsl );
printf("\ncompile: %s on GL name %p ", tempname, glslDesc->m_object.glsl );
}
result = glslDesc->m_valid;
@@ -669,6 +669,8 @@ bool CGLMProgram::CheckValidity( EGLMProgramLang lang )
}
break;
}
return false;
}
void CGLMProgram::LogSlow( EGLMProgramLang lang )
@@ -1002,11 +1004,12 @@ bool CGLMShaderPair::RefreshProgramPair ( void )
if (vpgood && fpgood)
{
SetProgramPair( vp, fp );
return SetProgramPair( vp, fp );
}
else
{
Debugger();
return false;
}
}
@@ -1168,7 +1171,7 @@ CGLMShaderPair *CGLMShaderPairCache::SelectShaderPair( CGLMProgram *vp, CGLMProg
if (loglevel >= 3) // hits logged at level 3 and higher
{
printf("\nSSP: hit - row %05d - pair $%08x (%d'th hit on row)",rowIndex, hit->m_pair, m_hits[ rowIndex ] );
printf("\nSSP: hit - row %05d - pair $%p (%d'th hit on row)",rowIndex, hit->m_pair, m_hits[ rowIndex ] );
}
result = hit->m_pair;
+3 -3
View File
@@ -572,7 +572,7 @@ GLMTexLayout *CGLMTexLayoutTable::NewLayoutRef( GLMTexLayoutKey *key )
case GL_TEXTURE_CUBE_MAP: targetname = "CUBE"; break;
}
sprintf( scratch, "[%s %s %dx%dx%d mips=%d slices=%d flags=%02X%s]",
sprintf( scratch, "[%s %s %dx%dx%d mips=%d slices=%d flags=%02lX%s]",
targetname,
formatDesc->m_formatSummary,
layout->m_key.m_xSize, layout->m_key.m_ySize, layout->m_key.m_zSize,
@@ -698,7 +698,7 @@ CGLMTex::CGLMTex( GLMContext *ctx, GLMTexLayout *layout, GLMTexSamplingParams *s
if (gl_texmsaalog/* .GetInt() */)
{
printf( "\n == MSAA Tex %8x %s : MSAA RBO is intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, msaaFormat ), msaaFormat );
printf( "\n == MSAA Tex %p %s : MSAA RBO is intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, msaaFormat ), msaaFormat );
}
glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, 0 );
@@ -1406,7 +1406,7 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
{
if (gl_texmsaalog/* .GetInt() */)
{
printf( "\n == MSAA Tex %8x %s : glTexImage2D for flat tex using intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, intformat ), intformat );
printf( "\n == MSAA Tex %p %s : glTexImage2D for flat tex using intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, intformat ), intformat );
printf( "\n" );
}
}
+9 -9
View File
@@ -157,7 +157,7 @@ void ReplaceParamName( const char *pSrc, const char *pNewParamName, char *pOut,
const char *pDot = GetSwizzleDot( pSrc );
if ( pDot )
{
V_strncat( pOut, pDot, nOutLen );
strncat( pOut, pDot, nOutLen - strlen( pOut ) - 1 );
}
}
@@ -899,7 +899,7 @@ CUtlString D3DToGL::FixGLSLSwizzle( const char *pDestRegisterName, const char *p
char szFixedSrcRegister[128];
GetParamNameWithoutSwizzle( pSrcRegisterName, szFixedSrcRegister, sizeof( szFixedSrcRegister ) );
V_strncat( szFixedSrcRegister, ".", sizeof( szFixedSrcRegister ) );
strncat( szFixedSrcRegister, ".", sizeof(szFixedSrcRegister) - strlen(szFixedSrcRegister) - 1 );
for ( int i=0; i < nSwizzlesInDest; i++ )
{
char chDestWriteMask = GetSwizzleComponent( pDestRegisterName, i );
@@ -908,7 +908,7 @@ CUtlString D3DToGL::FixGLSLSwizzle( const char *pDestRegisterName, const char *p
char ch[2];
ch[0] = GetSwizzleComponent( pSrcRegisterName, nVectorIndex );
ch[1] = 0;
V_strncat( szFixedSrcRegister, ch, sizeof( szFixedSrcRegister ) );
strncat( szFixedSrcRegister, ch, sizeof(szFixedSrcRegister) - strlen(szFixedSrcRegister) - 1 );
}
SimplifyFourParamRegister( szFixedSrcRegister );
@@ -1532,9 +1532,9 @@ void D3DToGL::AddTokenHexCodeToBuffer( char *pBuffer, int nSize, int nLastStrlen
{
char szTemp[32];
V_snprintf( szTemp, sizeof( szTemp ), "0x%x ", m_pRecordedInputTokenStart[i] );
V_strncat( szHex, szTemp, sizeof( szHex ) );
strncat( szHex, szTemp, sizeof(szHex) - strlen(szHex) - 1 );
}
V_strncat( szHex, "\n", sizeof( szHex ) );
strncat( szHex, "\n", sizeof(szHex) - strlen(szHex) - 1 );
// Insert the hex codes into the string.
int nBytesToInsert = V_strlen( szHex );
@@ -1547,7 +1547,7 @@ void D3DToGL::AddTokenHexCodeToBuffer( char *pBuffer, int nSize, int nLastStrlen
if ( pBuffer[nCurStrlen-1] == '\n' )
pBuffer[nCurStrlen-1] = 0;
V_strncat( pBuffer, &szHex[1], nSize );
strncat( pBuffer, &szHex[1], nSize - strlen( pBuffer ) - 1 );
}
else
{
@@ -1746,7 +1746,7 @@ void D3DToGL::Handle_DEF()
if ( !strchr( szTemp, '.' ) )
{
V_strncat( szTemp, ".0", sizeof( szTemp ) );
strncat( szTemp, ".0", sizeof(szTemp) - strlen(szTemp) - 1 );
}
PrintToBuf( *m_pBufParamCode, i != 3 ? "%s, " : "%s", szTemp ); // end with comma-space
@@ -2044,7 +2044,7 @@ void D3DToGL::Handle_TEX( uint32 dwToken, bool bIsTexLDL )
char szLOD[128], szExtra[8];
GetParamNameWithoutSwizzle( pSrc0Reg, szLOD, sizeof( szLOD ) );
V_snprintf( szExtra, sizeof( szExtra ), ".%c", GetSwizzleComponent( pSrc0Reg, 3 ) );
V_strncat( szLOD, szExtra, sizeof( szLOD ) );
strncat( szLOD, szExtra, sizeof(szLOD) - strlen(szLOD) - 1 );
PrintToBuf( *m_pBufALUCode, "%s = texture2DLod( %s, %s, %s );\n", pDestReg, pSrc1Reg, sCoordVar.String(), szLOD );
}
@@ -2780,7 +2780,7 @@ 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(), m_bGLSL ? "#version 120\n%s" : "!!ARBfp1.0\n", glslBindableUniformExtText );
V_snprintf( (char *)m_pBufHeaderCode->Base(), m_pBufHeaderCode->Size(), m_bGLSL ? "#version 120\n%s" : "!!ARBfp1.0\n%s", glslBindableUniformExtText );
m_bVertexShader = false;
}
else // vertex shader
+41 -4
View File
@@ -968,6 +968,9 @@ UINT IDirect3D9::GetAdapterCount()
int dxAdapterCount = db->GetFakeAdapterCount();
return dxAdapterCount;
#else
Debugger();
return 0;
#endif
}
@@ -1150,6 +1153,9 @@ HRESULT IDirect3D9::GetAdapterIdentifier( UINT Adapter, DWORD Flags, D3DADAPTER_
#endif
return S_OK;
#else
Debugger();
return D3DERR_INVALIDCALL;
#endif
}
@@ -1361,6 +1367,9 @@ HRESULT IDirect3D9::CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORM
}
return result;
#else
Debugger();
return D3DERR_INVALIDCALL;
#endif
}
@@ -1387,7 +1396,9 @@ UINT IDirect3D9::GetAdapterModeCount(UINT Adapter,D3DFORMAT Format)
GLMPRINTF(( "-X- --> result is %d", modeCount ));
return modeCount;
#else
Debugger();
return 0;
#endif
}
@@ -1424,7 +1435,9 @@ HRESULT IDirect3D9::EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3D
GLMPRINTF(( "-X- IDirect3D9::EnumAdapterModes returning mode size (%d,%d) and D3DFMT_X8R8G8B8",pMode->Width,pMode->Height ));
return S_OK;
#else
Debugger();
return D3DERR_INVALIDCALL;
#endif
}
@@ -1475,7 +1488,9 @@ HRESULT IDirect3D9::GetAdapterDisplayMode(UINT Adapter,D3DDISPLAYMODE* pMode)
pMode->Format = D3DFMT_X8R8G8B8; //FIXME, this is a SWAG
return S_OK;
#else
Debugger();
return D3DERR_INVALIDCALL;
#endif
}
@@ -1587,6 +1602,9 @@ HRESULT IDirect3D9::CheckDeviceMultiSampleType( UINT Adapter,D3DDEVTYPE DeviceTy
break;
}
return D3DERR_NOTAVAILABLE;
#else
Debugger();
return D3DERR_NOTAVAILABLE;
#endif
}
@@ -2172,6 +2190,9 @@ HRESULT IDirect3DDevice9::Create( IDirect3DDevice9Params *params )
g_engine->RenderedSize( m_params.m_presentationParameters.BackBufferWidth, m_params.m_presentationParameters.BackBufferHeight, true ); // true = set
return result;
#else
Debugger();
return D3DERR_INVALIDCALL;
#endif
}
@@ -2322,6 +2343,9 @@ HRESULT IDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters)
m_ctx->SetDisplayParams( &glmParams );
return S_OK;
#else
Debugger();
return D3DERR_INVALIDCALL;
#endif
}
@@ -3585,11 +3609,13 @@ HRESULT IDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDec
HRESULT IDirect3DDevice9::SetFVF(DWORD FVF)
{
Debugger();
return D3DERR_INVALIDCALL;
}
HRESULT IDirect3DDevice9::GetFVF(DWORD* pFVF)
{
Debugger();
return D3DERR_INVALIDCALL;
}
@@ -3617,6 +3643,8 @@ HRESULT IDirect3DDevice9::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffe
m_streams[ StreamNumber ].m_offset = 0;
m_streams[ StreamNumber ].m_stride = 0;
}
return S_OK;
}
#pragma mark ----- Index Buffers - (IDirect3DDevice9)
@@ -3626,6 +3654,7 @@ HRESULT IDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData)
{
// just latch it.
m_indices.m_idxBuffer = pIndexData;
return S_OK;
}
@@ -4716,6 +4745,8 @@ HRESULT IDirect3DDevice9::FlushStates( uint mask )
m_ctx->WriteClearStencil( &gl.m_ClearStencil );
gl.m_stateDirtyMask &= (~stateHitMask);
return S_OK;
}
@@ -5002,12 +5033,16 @@ HRESULT IDirect3DDevice9::FlushSamplers( uint mask )
glsamp->m_compareMode = dxsamp->m_shadowFilter ? GL_COMPARE_R_TO_TEXTURE_ARB : GL_NONE;
}
}
return S_OK;
}
HRESULT IDirect3DDevice9::FlushIndexBindings( void )
{
// push index buffer state
m_ctx->SetIndexBuffer( m_indices.m_idxBuffer->m_idxBuffer );
return S_OK;
}
#if 0
@@ -5221,6 +5256,8 @@ HRESULT IDirect3DDevice9::FlushVertexBindings( uint baseVertexIndex )
memcpy( &setup.m_vtxAttribMap, m_vertexShader->m_vtxAttribMap, sizeof( m_vertexShader->m_vtxAttribMap ) );
m_ctx->SetVertexAttributes( &setup );
return S_OK;
}
@@ -5228,6 +5265,7 @@ HRESULT IDirect3DDevice9::FlushVertexBindings( uint baseVertexIndex )
HRESULT IDirect3DDevice9::FlushGLM( void )
{
Debugger();// old routine not used now
return D3DERR_INVALIDCALL;
}
HRESULT IDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount)
@@ -5492,7 +5530,6 @@ void IDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARA
// just slam it directly for the time being
// this code is OS X specific
CGTableCount sampleCount;
CGDisplayErr cgErr;
CGGammaValue redt[256];
+8 -1
View File
@@ -11,6 +11,10 @@
extern CGameEngineGL *g_engine; // so glmgr (which is C++) can call up to the game engine ObjC object and ask for things..
#ifdef __clang__
#pragma clang diagnostic warning "-Wint-to-pointer-cast"
#endif
//===============================================================================
@@ -2310,6 +2314,7 @@ bool GLMContext::SetDisplayParams( GLMDisplayParams *params )
{
m_displayParams = *params; // latch em
m_displayParamsValid = true;
return true;
}
//extern ConVar gl_singlecontext; // single context mode go-ahead if 10.6.3 or higher
@@ -2725,6 +2730,8 @@ int GLMContext::BindTexToTMU( CGLMTex *tex, int tmu, bool noCheck )
}
m_samplers[tmu].m_boundTex = NULL;
}
return 0;
}
void GLMContext::BindFBOToCtx( CGLMFBO *fbo, GLenum bindPoint )
@@ -2871,7 +2878,7 @@ void GLMContext::FlushDrawStates( bool shadersOn ) // shadersOn = true for draw
if (tex->m_rboName) // is it MSAA
{
// mark it dirty
tex->m_rboDirty++;
tex->m_rboDirty = true;
}
}
}
-1
View File
@@ -154,7 +154,6 @@ private:
#define V_vsnprintf(a,b,c,d) vsprintf(a,c,d) // double check this
#define V_snprintf snprintf
#define V_strncpy strncpy
#define V_strncat strncat
#define V_strcmp strcmp
#define V_strlen strlen
#define V_strstr strstr
+3
View File
@@ -18,6 +18,9 @@ PFNglDisableIndexedEXT pfnglDisableIndexedEXT;
PFNglGetFramebufferAttachmentParameteriv pfnglGetFramebufferAttachmentParameteriv;
PFNglUniformBufferEXT pfnglUniformBufferEXT;
// NSSymbol was deprecated in 10.5.
#pragma clang diagnostic warning "-Wdeprecated-declarations"
void * NSGLGetProcAddress (const char *name)
{
NSSymbol symbol;