Browse Source

togles: use original glCompressedTexture2D when gpu have DXT support

sanitize
nillerusr 3 years ago
parent
commit
ce68fffa3b
  1. 2
      togles/linuxwin/cglmbuffer.cpp
  2. 20
      togles/linuxwin/cglmtex.cpp
  3. 4
      togles/linuxwin/glentrypoints.cpp
  4. 5
      togles/linuxwin/glmgr.cpp

2
togles/linuxwin/cglmbuffer.cpp

@ -472,7 +472,7 @@ CGLMBuffer::CGLMBuffer( GLMContext *pCtx, EGLMBufferType type, uint size, uint o
m_bPseudo = true; m_bPseudo = true;
#endif #endif
const char *szRenderer = gGL->glGetString(GL_VENDOR); const char *szRenderer = (const char*)gGL->glGetString(GL_VENDOR);
// Msg("GL_VENDOR: %s\n", szRenderer); // Msg("GL_VENDOR: %s\n", szRenderer);
if( strcmp(szRenderer, "ARM") == 0 ) if( strcmp(szRenderer, "ARM") == 0 )

20
togles/linuxwin/cglmtex.cpp

@ -3435,15 +3435,15 @@ GLvoid *uncompressDXTc(GLsizei width, GLsizei height, GLenum format, GLsizei ima
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
DecompressBlockDXT1(x, y, width, (uint8_t*)src, transparent0, simpleAlpha, complexAlpha, pixels); DecompressBlockDXT1(x, y, width, (uint8_t*)src, transparent0, simpleAlpha, complexAlpha, (uint32_t*)pixels);
break; break;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
DecompressBlockDXT3(x, y, width, (uint8_t*)src, transparent0, simpleAlpha, complexAlpha, pixels); DecompressBlockDXT3(x, y, width, (uint8_t*)src, transparent0, simpleAlpha, complexAlpha, (uint32_t*)pixels);
break; break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
DecompressBlockDXT5(x, y, width, (uint8_t*)src, transparent0, simpleAlpha, complexAlpha, pixels); DecompressBlockDXT5(x, y, width, (uint8_t*)src, transparent0, simpleAlpha, complexAlpha, (uint32_t*)pixels);
break; break;
} }
src+=blocksize; src+=blocksize;
@ -3641,24 +3641,18 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa
// adjust target to steer to the proper face, then fall through to the 2D texture path. // adjust target to steer to the proper face, then fall through to the 2D texture path.
target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + desc->m_req.m_face; target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + desc->m_req.m_face;
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
{ {
// check compressed or not // check compressed or not
if (format->m_chunkSize != 1) if (format->m_chunkSize != 1)
{ {
Assert( writeWholeSlice ); //subimage not implemented in this path yet Assert( writeWholeSlice ); //subimage not implemented in this path yet
// compressed path // compressed path
// http://www.opengl.org/sdk/docs/man/xhtml/glCompressedTexImage2D.xml // http://www.opengl.org/sdk/docs/man/xhtml/glCompressedTexImage2D.xml
CompressedTexImage2D( target, // target if( gGL->m_bHave_GL_EXT_texture_compression_dxt1 )
desc->m_req.m_mip, // level gGL->glCompressedTexImage2D( target, desc->m_req.m_mip, intformat, slice->m_xSize, slice->m_ySize, 0, slice->m_storageSize, sliceAddress );
intformat, // internalformat - don't use format->m_glIntFormat because we have the SRGB select going on above else
slice->m_xSize, // width CompressedTexImage2D( target, desc->m_req.m_mip, intformat, slice->m_xSize, slice->m_ySize, 0, slice->m_storageSize, sliceAddress );
slice->m_ySize, // height
0, // border
slice->m_storageSize, // imageSize
sliceAddress ); // data
} }
else else
{ {

4
togles/linuxwin/glentrypoints.cpp

@ -485,12 +485,12 @@ COpenGLEntryPoints::COpenGLEntryPoints()
} }
#endif #endif
#ifndef OSX /*#ifndef OSX
if ( !m_bHave_GL_EXT_texture_sRGB_decode ) if ( !m_bHave_GL_EXT_texture_sRGB_decode )
{ {
Error( "Required OpenGL extension \"GL_EXT_texture_sRGB_decode\" is not supported. Please update your OpenGL driver.\n" ); Error( "Required OpenGL extension \"GL_EXT_texture_sRGB_decode\" is not supported. Please update your OpenGL driver.\n" );
} }
#endif #endif*/
} }
COpenGLEntryPoints::~COpenGLEntryPoints() COpenGLEntryPoints::~COpenGLEntryPoints()

5
togles/linuxwin/glmgr.cpp

@ -1729,14 +1729,13 @@ void GLMContext::PreloadTex( CGLMTex *tex, bool force )
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f }; 0.0f, 0.0f, 0.0f };
static int indices[] = { 0, 1, 2 }; static unsigned short indices[] = { 0, 1, 2 };
gGL->glEnableVertexAttribArray( 0 ); gGL->glEnableVertexAttribArray( 0 );
gGL->glVertexAttribPointer( 0, 3, GL_FLOAT, 0, 0, posns ); gGL->glVertexAttribPointer( 0, 3, GL_FLOAT, 0, 0, posns );
gGL->glDrawRangeElements( GL_TRIANGLES, 0, 2, 3, GL_UNSIGNED_INT, indices); gGL->glDrawRangeElements( GL_TRIANGLES, 0, 2, 3, GL_UNSIGNED_SHORT, indices);
gGL->glDisableVertexAttribArray( 0 ); gGL->glDisableVertexAttribArray( 0 );

Loading…
Cancel
Save