mirror of
https://github.com/jenshemprich/MacGLide.git
synced 2025-03-12 14:31:20 +00:00
Cleaned up APPLE_client_storage - fixed 565 chromakeyed textures (autsch :^)
This commit is contained in:
parent
0bb2b8d61a
commit
21db87ffbc
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -65,7 +65,7 @@ stExtensionSupport glNecessaryExt[] =
|
||||
{ "GL_SGIS_texture_edge_clamp", OGL_EXT_DESIRED, &dummyExtVariable, &InternalConfig.EXT_SGIS_texture_edge_clamp },
|
||||
{ "GL_EXT_paletted_texture", OGL_EXT_DESIRED, &UserConfig.EXT_paletted_texture, &InternalConfig.EXT_paletted_texture },
|
||||
{ "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, &UserConfig.APPLE_client_storage, &InternalConfig.APPLE_client_storage },
|
||||
{ "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
|
||||
@ -249,7 +249,7 @@ void GLExtensions(void)
|
||||
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)
|
||||
if (InternalConfig.APPLE_client_storage)
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, true);
|
||||
glReportError();
|
||||
|
@ -194,7 +194,7 @@ void GlideSettings::defaults()
|
||||
EXT_secondary_color = true;
|
||||
EXT_SGIS_generate_mipmap = true;
|
||||
EXT_SGIS_texture_edge_clamp = true;
|
||||
EXT_Client_Storage = true;
|
||||
APPLE_client_storage = true;
|
||||
EXT_compiled_vertex_array = true;
|
||||
ARB_texture_rectangle = true;
|
||||
EXT_texture_filter_anisotropic = true;
|
||||
@ -255,6 +255,7 @@ GlideSettings::IOErr GlideSettings::read_settings()
|
||||
get("PedanticFrameBufferEmulation", &PedanticFrameBufferEmulation);
|
||||
get("EXT_compiled_vertex_array", &EXT_compiled_vertex_array);
|
||||
get("ARB_texture_rectangle", &ARB_texture_rectangle);
|
||||
get("APPLE_client_storage", &APPLE_client_storage);
|
||||
get("ARB_multitexture", &ARB_multitexture);
|
||||
get("EXT_paletted_texture", &EXT_paletted_texture);
|
||||
get("EXT_clip_volume_hint", &EXT_clip_volume_hint);
|
||||
@ -502,6 +503,7 @@ GlideSettings::IOErr GlideSettings::saveSettings()
|
||||
put();
|
||||
put("EXT_compiled_vertex_array", EXT_compiled_vertex_array);
|
||||
put("ARB_texture_rectangle", ARB_texture_rectangle);
|
||||
put("APPLE_client_storage", APPLE_client_storage);
|
||||
put("ARB_multitexture", ARB_multitexture);
|
||||
put("EXT_paletted_texture", EXT_paletted_texture);
|
||||
put("EXT_clip_volume_hint", EXT_clip_volume_hint);
|
||||
|
@ -98,7 +98,7 @@ struct ConfigStruct
|
||||
bool EXT_paletted_texture;
|
||||
bool EXT_SGIS_generate_mipmap;
|
||||
bool EXT_SGIS_texture_edge_clamp;
|
||||
bool EXT_Client_Storage;
|
||||
bool APPLE_client_storage;
|
||||
bool EXT_compiled_vertex_array;
|
||||
bool ARB_texture_rectangle;
|
||||
#ifdef OPENGLIDE_SYSTEM_HAS_FOGCOORD
|
||||
|
@ -60,7 +60,7 @@ void PGTexture::genPaletteMipmaps( FxU32 width, FxU32 height, const FxU8 *data )
|
||||
}
|
||||
}
|
||||
|
||||
PGTexture::PGTexture( int mem_size )
|
||||
PGTexture::PGTexture(int mem_size)
|
||||
{
|
||||
m_db = new TexDB( mem_size );
|
||||
m_palette_dirty = true;
|
||||
@ -68,8 +68,17 @@ PGTexture::PGTexture( int mem_size )
|
||||
m_chromakey_mode = GR_CHROMAKEY_DISABLE;
|
||||
m_tex_memory_size = mem_size;
|
||||
m_memory = (FxU8*) AllocBuffer(mem_size, sizeof(FxU8));
|
||||
if (InternalConfig.EXT_Client_Storage)
|
||||
// This is initialized before the rendering context is available and before
|
||||
// the list of OpenGL extensions can be checked against APPLE_client_storage.
|
||||
// As a result the texture buffer is allocated bases on the user setting.
|
||||
// And it might be legal to download textures before grWinOpen() so
|
||||
// using the user config setting is the best we can do
|
||||
if (UserConfig.APPLE_client_storage)
|
||||
{
|
||||
// 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
|
||||
// Alloc 4-times the size of the Glide buffer for texture storage
|
||||
m_textureCache = reinterpret_cast<FxU32*>(AllocBuffer(m_tex_memory_size, sizeof(FxU32)));
|
||||
// No memory is wasted here because we save the internal OpenGL copy
|
||||
@ -623,14 +632,9 @@ bool PGTexture::MakeReady(TTextureStruct* tex_coords, unsigned long number_of_tr
|
||||
}
|
||||
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)
|
||||
{
|
||||
// EXT_Client_Storage doesn't explicitely forbid to adjust pixel unpack :^)
|
||||
// APPLE_client_storage doesn't explicitely forbid to adjust pixel unpack :^)
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, subtexcoords->left);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, subtexcoords->top);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, texVals.width);
|
||||
@ -640,11 +644,9 @@ bool PGTexture::MakeReady(TTextureStruct* tex_coords, unsigned long number_of_tr
|
||||
}
|
||||
FxU32* texBuffer;
|
||||
// Which buffer
|
||||
if (useClientStorage)
|
||||
if (m_textureCache)
|
||||
{
|
||||
texBuffer = &m_textureCache[m_startAddress];
|
||||
// glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, true);
|
||||
// glReportError();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -658,7 +660,7 @@ bool PGTexture::MakeReady(TTextureStruct* tex_coords, unsigned long number_of_tr
|
||||
{
|
||||
// Read about anisotropy and chromakey issues in macFormatConversions.cpp
|
||||
Convert565Kto8888((FxU16*)data, m_chromakey_value_565, texBuffer, texVals.nPixels);
|
||||
DownloadMipmapsToOpenGL(4, GL_RGBA, GL_UNSIGNED_BYTE, m_tex_temp, texVals, !use_mipmap_ext);
|
||||
DownloadMipmapsToOpenGL(4, GL_RGBA, GL_UNSIGNED_BYTE, texBuffer, texVals, !use_mipmap_ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user