mirror of
https://github.com/jenshemprich/MacGLide.git
synced 2025-03-13 05:29:21 +00:00
EXT_client_texture global mode
This commit is contained in:
parent
518e9eabf2
commit
70e3fd1aec
@ -67,6 +67,7 @@ stExtensionSupport glNecessaryExt[] =
|
|||||||
{ "GL_APPLE_packed_pixels", OGL_EXT_REQUIRED, &dummyExtVariable, &dummyExtVariable2 },
|
{ "GL_APPLE_packed_pixels", OGL_EXT_REQUIRED, &dummyExtVariable, &dummyExtVariable2 },
|
||||||
{ "GL_APPLE_client_storage", OGL_EXT_DESIRED, &dummyExtVariable, &InternalConfig.EXT_Client_Storage },
|
{ "GL_APPLE_client_storage", OGL_EXT_DESIRED, &dummyExtVariable, &InternalConfig.EXT_Client_Storage },
|
||||||
{ "GL_EXT_compiled_vertex_array", OGL_EXT_DESIRED, &UserConfig.EXT_compiled_vertex_array,&InternalConfig.EXT_compiled_vertex_array },
|
{ "GL_EXT_compiled_vertex_array", OGL_EXT_DESIRED, &UserConfig.EXT_compiled_vertex_array,&InternalConfig.EXT_compiled_vertex_array },
|
||||||
|
{ "GL_ARB_texture_rectangle", OGL_EXT_DESIRED, &UserConfig.ARB_texture_rectangle, &InternalConfig.ARB_texture_rectangle },
|
||||||
#ifdef OPENGLIDE_SYSTEM_HAS_FOGCOORD
|
#ifdef OPENGLIDE_SYSTEM_HAS_FOGCOORD
|
||||||
{ "GL_EXT_fog_coord", OGL_EXT_DESIRED, &dummyExtVariable, &InternalConfig.EXT_fog_coord },
|
{ "GL_EXT_fog_coord", OGL_EXT_DESIRED, &dummyExtVariable, &InternalConfig.EXT_fog_coord },
|
||||||
#endif
|
#endif
|
||||||
@ -247,6 +248,13 @@ void GLExtensions(void)
|
|||||||
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &MaxAnisotropyLevel);
|
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &MaxAnisotropyLevel);
|
||||||
GlideMsg("Maximum level of anisotropy = %d\n", MaxAnisotropyLevel);
|
GlideMsg("Maximum level of anisotropy = %d\n", MaxAnisotropyLevel);
|
||||||
|
|
||||||
|
// Since this a global setting, texture data must not be uploaded from temp buffers
|
||||||
|
if (InternalConfig.EXT_Client_Storage)
|
||||||
|
{
|
||||||
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, true);
|
||||||
|
glReportError();
|
||||||
|
}
|
||||||
|
|
||||||
if (InternalConfig.EXT_texture_filter_anisotropic)
|
if (InternalConfig.EXT_texture_filter_anisotropic)
|
||||||
{
|
{
|
||||||
GLint MaxAnisotropyLevel;
|
GLint MaxAnisotropyLevel;
|
||||||
|
@ -623,8 +623,14 @@ bool PGTexture::MakeReady(TTextureStruct* tex_coords, unsigned long number_of_tr
|
|||||||
}
|
}
|
||||||
glReportError();
|
glReportError();
|
||||||
|
|
||||||
|
// use client storage to avoid OpenGL-internal copy
|
||||||
|
// OpenGL may still make a copy if the color format isn't supported natively
|
||||||
|
// by the graphics card but all xto8888 conversions should benefit from this
|
||||||
|
// @todo: Not true for OSX, but for now we stay compatible to native OS9
|
||||||
|
const bool useClientStorage = InternalConfig.EXT_Client_Storage /* && !subtexcoords */;
|
||||||
if (subtexcoords)
|
if (subtexcoords)
|
||||||
{
|
{
|
||||||
|
// EXT_Client_Storage doesn't explicitely forbid to adjust pixel unpack :^)
|
||||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, subtexcoords->left);
|
glPixelStorei(GL_UNPACK_SKIP_PIXELS, subtexcoords->left);
|
||||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, subtexcoords->top);
|
glPixelStorei(GL_UNPACK_SKIP_ROWS, subtexcoords->top);
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, texVals.width);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, texVals.width);
|
||||||
@ -632,26 +638,23 @@ bool PGTexture::MakeReady(TTextureStruct* tex_coords, unsigned long number_of_tr
|
|||||||
texVals.width = subtexcoords->texImageWidth;
|
texVals.width = subtexcoords->texImageWidth;
|
||||||
texVals.height = subtexcoords->texImageHeight;
|
texVals.height = subtexcoords->texImageHeight;
|
||||||
}
|
}
|
||||||
// use client storage to avoid OpenGL-internal copy
|
|
||||||
// OpenGL may still make a copy if the colro format isn't supported natively
|
|
||||||
// by the graphics card but all xto8888 conversions should benefit from this
|
|
||||||
const bool useClientStorage = InternalConfig.EXT_Client_Storage && !subtexcoords;
|
|
||||||
FxU32* texBuffer;
|
FxU32* texBuffer;
|
||||||
|
// Which buffer
|
||||||
if (useClientStorage)
|
if (useClientStorage)
|
||||||
{
|
{
|
||||||
texBuffer = &m_textureCache[m_startAddress];
|
texBuffer = &m_textureCache[m_startAddress];
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, true);
|
// glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, true);
|
||||||
glReportError();
|
// glReportError();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texBuffer = m_tex_temp;
|
texBuffer = m_tex_temp;
|
||||||
}
|
}
|
||||||
// Convert Glide texture data to format understood by OpenGL
|
// Convert Glide texture data to format understood by OpenGL
|
||||||
switch ( m_info.format )
|
switch (m_info.format)
|
||||||
{
|
{
|
||||||
case GR_TEXFMT_RGB_565:
|
case GR_TEXFMT_RGB_565:
|
||||||
if ( m_chromakey_mode )
|
if (m_chromakey_mode)
|
||||||
{
|
{
|
||||||
// Read about anisotropy and chromakey issues in macFormatConversions.cpp
|
// Read about anisotropy and chromakey issues in macFormatConversions.cpp
|
||||||
Convert565Kto8888((FxU16*)data, m_chromakey_value_565, texBuffer, texVals.nPixels);
|
Convert565Kto8888((FxU16*)data, m_chromakey_value_565, texBuffer, texVals.nPixels);
|
||||||
@ -785,14 +788,14 @@ bool PGTexture::MakeReady(TTextureStruct* tex_coords, unsigned long number_of_tr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Cleanup
|
// Cleanup
|
||||||
if (useClientStorage)
|
// if (useClientStorage)
|
||||||
{
|
// {
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, false);
|
// glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, false);
|
||||||
glReportError();
|
// glReportError();
|
||||||
}
|
// }
|
||||||
if (subtexcoords)
|
if (subtexcoords)
|
||||||
{
|
{
|
||||||
// restore values
|
// restore default values
|
||||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user