1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Remove textureBitDepth settings.

Load textures using most relevant format.
This commit is contained in:
Sergey Lipskiy 2015-02-03 13:03:50 +06:00
parent df0791c054
commit 64d97e72e0
6 changed files with 4 additions and 62 deletions

View File

@ -20,7 +20,6 @@ struct Config
struct
{
u32 maxAnisotropy;
u32 textureBitDepth;
u32 forceBilinear;
u32 maxBytes;
} texture;

View File

@ -431,7 +431,6 @@ void TextureCache::init()
{
u32 dummyTexture[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
m_bitDepth = config.texture.textureBitDepth;
m_maxBytes = config.texture.maxBytes;
m_pDummy = addFrameBufferTexture(); // we don't want to remove dummy texture
@ -752,7 +751,7 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
GLenum glType;
const TextureLoadParameters & loadParams = imageFormat[pTexture->format == 2 ? G_TT_RGBA16 : G_TT_NONE][pTexture->size][pTexture->format];
if (((loadParams.autoFormat == GL_RGBA) || (m_bitDepth == 2)) && (m_bitDepth != 0)) {
if (loadParams.autoFormat == GL_RGBA) {
pTexture->textureBytes = (pTexture->realWidth * pTexture->realHeight) << 2;
GetTexel = loadParams.Get32;
glInternalFormat = loadParams.glInternalFormat32;
@ -884,7 +883,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
u32 sizeShift;
const TextureLoadParameters & loadParams = imageFormat[gDP.otherMode.textureLUT][_pTexture->size][_pTexture->format];
if (((loadParams.autoFormat == GL_RGBA) || (m_bitDepth == 2)) && (m_bitDepth != 0)) {
if (loadParams.autoFormat == GL_RGBA) {
sizeShift = 2;
_pTexture->textureBytes = (_pTexture->realWidth * _pTexture->realHeight) << sizeShift;
GetTexel = loadParams.Get32;
@ -1239,12 +1238,6 @@ void _updateShiftScale(u32 _t, CachedTexture *_pTexture)
void TextureCache::update(u32 _t)
{
if (m_bitDepth != config.texture.textureBitDepth)
{
destroy();
init();
}
switch(gSP.textureTile[_t]->textureMode) {
case TEXTUREMODE_BGIMAGE:
_updateBackground();

View File

@ -64,7 +64,7 @@ struct TextureCache
}
private:
TextureCache() : m_pDummy(NULL), m_hits(0), m_misses(0), m_bitDepth(0), m_maxBytes(0), m_cachedBytes(0)
TextureCache() : m_pDummy(NULL), m_hits(0), m_misses(0), m_maxBytes(0), m_cachedBytes(0)
{
current[0] = NULL;
current[1] = NULL;
@ -85,7 +85,6 @@ private:
Textures m_fbTextures;
CachedTexture * m_pDummy;
u32 m_hits, m_misses;
u32 m_bitDepth;
u32 m_maxBytes;
u32 m_cachedBytes;
};

View File

@ -51,8 +51,6 @@ bool Config_SetDefault()
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultInt(g_configVideoGliden64, "CacheSize", 500, "Size of texture cache in megabytes. Good value is VRAM*3/4");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultInt(g_configVideoGliden64, "TextureBitDepth", 1, "Texture bit depth (0=16bit only, 1=16 and 32 bit, 2=32bit only)");
assert(res == M64ERR_SUCCESS);
//#Emulation Settings
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableFog", 1, "Enable fog emulation.");
assert(res == M64ERR_SUCCESS);
@ -144,7 +142,6 @@ void Config_LoadConfig()
//#Texture Settings
config.texture.forceBilinear = ConfigGetParamBool(g_configVideoGliden64, "ForceBilinear");
config.texture.maxBytes = ConfigGetParamInt(g_configVideoGliden64, "CacheSize") * uMegabyte;
config.texture.textureBitDepth = ConfigGetParamInt(g_configVideoGliden64, "TextureBitDepth");
//#Emulation Settings
config.generalEmulation.enableFog = ConfigGetParamBool(g_configVideoGliden64, "EnableFog");
config.generalEmulation.enableNoise = ConfigGetParamBool(g_configVideoGliden64, "EnableNoise");
@ -217,7 +214,6 @@ Option configOptions[] =
{"#Texture Settings:", NULL, 0},
{"force bilinear", &config.texture.forceBilinear, 0},
{"cache size", &config.texture.maxBytes, 64 * uMegabyte},
{"texture bit depth", &config.texture.textureBitDepth, 1},
{"#Emulation Settings:", NULL, 0},
{"enable fog", &config.generalEmulation.enableFog, 1},
{"enable noise", &config.generalEmulation.enableNoise, 1},

View File

@ -21,14 +21,6 @@ static GtkWidget *textureDepthCombo;
static GtkWidget *textureCacheEntry;
static const char *pluginDir = 0;
static const char *textureBitDepth[] =
{
"16-bit only (faster)",
"16-bit and 32-bit (normal)",
"32-bit only (best for 2xSaI)",
0
};
static void okButton_clicked( GtkWidget *widget, void *data )
{
const char *text;
@ -81,12 +73,6 @@ static void okButton_clicked( GtkWidget *widget, void *data )
config.frameBufferEmulation.enable = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck) );
config.generalEmulation.enableHWLighting = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareLighting) );
const char *depth = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(textureDepthCombo)->entry) );
config.texture.textureBitDepth = 1;
for (i = 0; textureBitDepth[i] != 0; i++)
{
if (!strcmp( depth, textureBitDepth[i] ))
config.texture.textureBitDepth = i;
}
config.texture.maxBytes = atoi( gtk_entry_get_text( GTK_ENTRY(textureCacheEntry) ) ) * 1048576;
// write configuration
@ -115,7 +101,6 @@ static void okButton_clicked( GtkWidget *widget, void *data )
fprintf( f, "enable fog=%d\n", config.generalEmulation.enableFog );
fprintf( f, "enable HardwareFB=%d\n", config.frameBufferEmulation.enable );
fprintf( f, "enable hardware lighting=%d\n", config.generalEmulation.enableHWLighting );
fprintf( f, "texture depth=%d\n", config.texture.textureBitDepth );
fprintf( f, "cache size=%d\n", config.texture.maxBytes / 1048576 );
fclose( f );
@ -156,7 +141,6 @@ static void configWindow_show( GtkWidget *widget, void *data )
// textures
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck), (config.frameBufferEmulation.enable) );
gtk_entry_set_text( GTK_ENTRY(GTK_COMBO(textureDepthCombo)->entry), textureBitDepth[config.texture.textureBitDepth] );
sprintf( text, "%d", config.texture.maxBytes / 1048576 );
gtk_entry_set_text( GTK_ENTRY(textureCacheEntry), text );
}
@ -315,20 +299,6 @@ static int Config_CreateWindow()
gtk_table_set_row_spacings( GTK_TABLE(texturesTable), 3 );
gtk_container_add( GTK_CONTAINER(texturesFrame), texturesTable );
textureDepthLabel = gtk_label_new( "Texture bit depth" );
textureDepthCombo = gtk_combo_new();
if (!textureDepthList)
{
i = 0;
while (textureBitDepth[i] != 0)
{
textureDepthList = g_list_append( textureDepthList, (void *)textureBitDepth[i] );
i++;
}
}
gtk_combo_set_popdown_strings( GTK_COMBO(textureDepthCombo), textureDepthList );
gtk_combo_set_value_in_list( GTK_COMBO(textureDepthCombo), TRUE, FALSE );
textureCacheLabel = gtk_label_new( "Texture cache size (MB)" );
textureCacheEntry = gtk_entry_new();
gtk_entry_set_text( GTK_ENTRY(textureCacheEntry), "0" );
@ -373,7 +343,6 @@ void Config_LoadConfig()
config.texture.forceBilinear = 0;
config.frameBufferEmulation.copyDepthToRDRAM = 0;
config.generalEmulation.enableFog = 1;
config.texture.textureBitDepth = 1; // normal (16 & 32 bits)
config.frameBufferEmulation.enable = 0;
config.generalEmulation.enableHWLighting = 0;
config.texture.maxBytes = 32 * 1048576;
@ -456,10 +425,6 @@ void Config_LoadConfig()
{
config.generalEmulation.enableHWLighting = atoi( val );
}
else if (!strcasecmp( line, "texture depth" ))
{
config.texture.textureBitDepth = atoi( val );
}
else
{
printf( "Unknown config option: %s\n", line );

View File

@ -92,9 +92,6 @@ void Config_LoadConfig()
RegQueryValueEx( hKey, "Hardware lighting", 0, NULL, (BYTE*)&value, &size );
config.generalEmulation.enableHWLighting = value ? TRUE : FALSE;
RegQueryValueEx( hKey, "Texture Bit Depth", 0, NULL, (BYTE*)&value, &size );
config.texture.textureBitDepth = value;
RegCloseKey( hKey );
}
else
@ -110,7 +107,6 @@ void Config_LoadConfig()
config.texture.maxBytes = 192 * uMegabyte;
config.frameBufferEmulation.enable = FALSE;
config.frameBufferEmulation.copyDepthToRDRAM = FALSE;
config.texture.textureBitDepth = 1;
config.generalEmulation.enableHWLighting = FALSE;
}
@ -158,9 +154,6 @@ void Config_SaveConfig()
value = config.generalEmulation.enableHWLighting ? 1 : 0;
RegSetValueEx( hKey, "Hardware lighting", 0, REG_DWORD, (BYTE*)&value, 4 );
value = config.texture.textureBitDepth;
RegSetValueEx( hKey, "Texture Bit Depth", 0, REG_DWORD, (BYTE*)&value, 4 );
RegCloseKey( hKey );
}
@ -182,9 +175,6 @@ void Config_ApplyDlgConfig( HWND hWndDlg )
config.video.fullscreenHeight = fullscreen.resolution[i].height;
config.video.fullscreenRefresh = fullscreen.refreshRate[SendDlgItemMessage( hWndDlg, IDC_FULLSCREENREFRESH, CB_GETCURSEL, 0, 0 )];
i = SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_GETCURSEL, 0, 0 );
config.texture.textureBitDepth = (int)i;
i = SendDlgItemMessage( hWndDlg, IDC_WINDOWEDRES, CB_GETCURSEL, 0, 0 );
config.video.windowedWidth = windowedModes[i].width;
config.video.windowedHeight = windowedModes[i].height;
@ -340,7 +330,7 @@ BOOL CALLBACK ConfigDlgProc( HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l
SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_ADDSTRING, 0, (LPARAM)"16-bit only (faster)" );
SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_ADDSTRING, 0, (LPARAM)"16-bit and 32-bit (normal)" );
SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_ADDSTRING, 0, (LPARAM)"32-bit only (best for 2xSaI)" );
SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_SETCURSEL, config.texture.textureBitDepth, 0 );
SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_SETCURSEL, 1, 0 );
// Enable/disable fog
SendDlgItemMessage( hWndDlg, IDC_FOG, BM_SETCHECK, config.generalEmulation.enableFog ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
SendDlgItemMessage( hWndDlg, IDC_FRAMEBUFFER, BM_SETCHECK, config.frameBufferEmulation.enable ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );