mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 14:16:50 +00:00
togles: use original glCompressedTexture2D when gpu have DXT support
This commit is contained in:
parent
2ec2a47a53
commit
ce68fffa3b
@ -472,7 +472,7 @@ CGLMBuffer::CGLMBuffer( GLMContext *pCtx, EGLMBufferType type, uint size, uint o
|
||||
m_bPseudo = true;
|
||||
#endif
|
||||
|
||||
const char *szRenderer = gGL->glGetString(GL_VENDOR);
|
||||
const char *szRenderer = (const char*)gGL->glGetString(GL_VENDOR);
|
||||
// Msg("GL_VENDOR: %s\n", szRenderer);
|
||||
|
||||
if( strcmp(szRenderer, "ARM") == 0 )
|
||||
|
@ -3435,15 +3435,15 @@ GLvoid *uncompressDXTc(GLsizei width, GLsizei height, GLenum format, GLsizei ima
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_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;
|
||||
case GL_COMPRESSED_RGBA_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;
|
||||
case GL_COMPRESSED_RGBA_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;
|
||||
}
|
||||
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.
|
||||
target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + desc->m_req.m_face;
|
||||
|
||||
case GL_TEXTURE_2D:
|
||||
{
|
||||
// check compressed or not
|
||||
if (format->m_chunkSize != 1)
|
||||
{
|
||||
Assert( writeWholeSlice ); //subimage not implemented in this path yet
|
||||
|
||||
// compressed path
|
||||
// http://www.opengl.org/sdk/docs/man/xhtml/glCompressedTexImage2D.xml
|
||||
CompressedTexImage2D( target, // target
|
||||
desc->m_req.m_mip, // level
|
||||
intformat, // internalformat - don't use format->m_glIntFormat because we have the SRGB select going on above
|
||||
slice->m_xSize, // width
|
||||
slice->m_ySize, // height
|
||||
0, // border
|
||||
slice->m_storageSize, // imageSize
|
||||
sliceAddress ); // data
|
||||
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
|
||||
CompressedTexImage2D( target, desc->m_req.m_mip, intformat, slice->m_xSize, slice->m_ySize, 0, slice->m_storageSize, sliceAddress );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -485,12 +485,12 @@ COpenGLEntryPoints::COpenGLEntryPoints()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OSX
|
||||
/*#ifndef OSX
|
||||
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" );
|
||||
}
|
||||
#endif
|
||||
#endif*/
|
||||
}
|
||||
|
||||
COpenGLEntryPoints::~COpenGLEntryPoints()
|
||||
|
@ -1729,14 +1729,13 @@ 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 unsigned short indices[] = { 0, 1, 2 };
|
||||
|
||||
gGL->glEnableVertexAttribArray( 0 );
|
||||
|
||||
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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user