misaligment fixes

This commit is contained in:
nillerusr
2022-05-15 21:09:59 +03:00
parent 1218fa659c
commit 3a73624b7e
39 changed files with 7592 additions and 6056 deletions

View File

@@ -472,10 +472,7 @@ CGLMBuffer::CGLMBuffer( GLMContext *pCtx, EGLMBufferType type, uint size, uint o
m_bPseudo = true;
#endif
const char *szRenderer = (const char*)gGL->glGetString(GL_VENDOR);
// Msg("GL_VENDOR: %s\n", szRenderer);
if( strcmp(szRenderer, "ARM") == 0 )
if( strcmp(gGL->m_pGLDriverStrings[cGLVendorString], "ARM") == 0 )
g_bUsePseudoBufs = true; // works faster with Mali gpu
#if GL_ENABLE_INDEX_VERIFICATION

View File

@@ -350,11 +350,10 @@ void CGLMProgram::Compile( EGLMProgramLang lang )
// compile
gGL->glCompileShader( glslDesc->m_object.glsl );
GLint isCompiled = 0;
gGL->glGetShaderiv(glslDesc->m_object.glsl, GL_COMPILE_STATUS, &isCompiled);
if(isCompiled == GL_FALSE)
{
GLint maxLength = 0;

View File

@@ -3649,9 +3649,9 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
Assert( writeWholeSlice ); //subimage not implemented in this path yet
// compressed path
// http://www.opengl.org/sdk/docs/man/xhtml/glCompressedTexImage2D.xml
if( gGL->m_bHave_GL_EXT_texture_compression_dxt1 )
/* if( gGL->m_bHave_GL_EXT_texture_compression_dxt1 )
gGL->glCompressedTexImage2D( target, desc->m_req.m_mip, intformat, slice->m_xSize, slice->m_ySize, 0, slice->m_storageSize, sliceAddress );
else
else*/
CompressedTexImage2D( target, desc->m_req.m_mip, intformat, slice->m_xSize, slice->m_ySize, 0, slice->m_storageSize, sliceAddress );
}
else

Binary file not shown.

View File

@@ -2148,23 +2148,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;
}
}
}

View File

@@ -206,7 +206,7 @@ void ToGLDisconnectLibraries()
static void GetOpenGLVersion(int *major, int *minor, int *patch)
{
*major = *minor = *patch = 0;
static CDynamicFunctionOpenGL< true, const GLubyte *( APIENTRY *)(GLenum name), const GLubyte * > glGetString("glGetString");
static CDynamicFunctionOpenGL< true, const GLubyte *( _APIENTRY *)(GLenum name), const GLubyte * > glGetString("glGetString");
if (glGetString)
{
const char *version = (const char *) glGetString(GL_VERSION);
@@ -271,7 +271,7 @@ static bool CheckOpenGLExtension_internal(const char *ext, const int coremajor,
}
// okay, see if the GL_EXTENSIONS string reports it.
static CDynamicFunctionOpenGL< true, const GLubyte *( APIENTRY *)(GLenum name), const GLubyte * > glGetString("glGetString");
static CDynamicFunctionOpenGL< true, const GLubyte *( _APIENTRY *)(GLenum name), const GLubyte * > glGetString("glGetString");
if (!glGetString)
return false;
@@ -284,7 +284,7 @@ static bool CheckOpenGLExtension_internal(const char *ext, const int coremajor,
#if _WIN32
if (!ptr)
{
static CDynamicFunctionOpenGL< true, const char *( APIENTRY *)( ), const char * > wglGetExtensionsStringEXT("wglGetExtensionsStringEXT");
static CDynamicFunctionOpenGL< true, const char *( _APIENTRY *)( ), const char * > wglGetExtensionsStringEXT("wglGetExtensionsStringEXT");
if (wglGetExtensionsStringEXT)
{
extensions = wglGetExtensionsStringEXT();

View File

@@ -221,7 +221,7 @@ void APIENTRY GL_Debug_Output_Callback(GLenum source, GLenum type, GLuint id, GL
return;
}
if ( gl_debug_output.GetBool() || type == GL_DEBUG_TYPE_ERROR_ARB )
if ( gl_debug_output.GetBool() || type == GL_DEBUG_TYPE_ERROR_ARB || type == GL_DEBUG_SEVERITY_MEDIUM_ARB )
{
Msg( "GL: [%s][%s][%s][%d]: %s\n", sSource, sType, sSeverity, id, message );
}