fixed setting of texture parameters like lod bias and max and min lod.

as a nice result of this eliminate the nasty glubuild2dmipmaps.
thanks to neobrain and orphis for discovering the error and the right values

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5475 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2010-05-25 19:25:31 +00:00
parent 2e12bd5e34
commit 99d0bd7762
2 changed files with 15 additions and 9 deletions

View file

@ -1418,8 +1418,9 @@ void Renderer::SetSamplerState(int stage, int texindex)
D3D::SetSamplerState(stage, D3DSAMP_ADDRESSU, d3dClamps[tm0.wrap_s]);
D3D::SetSamplerState(stage, D3DSAMP_ADDRESSV, d3dClamps[tm0.wrap_t]);
//just a test but it seems to work
D3D::SetSamplerState(stage,D3DSAMP_MIPMAPLODBIAS,tm0.lod_bias/2.0f);
D3D::SetSamplerState(stage,D3DSAMP_MAXMIPLEVEL,tm1.min_lod>>4);
float lodbias = tm0.lod_bias / 32.0f;
D3D::SetSamplerState(stage,D3DSAMP_MIPMAPLODBIAS,*(DWORD*)&lodbias);
D3D::SetSamplerState(stage,D3DSAMP_MAXMIPLEVEL,tm1.min_lod>>5);
}
void Renderer::SetInterlacingMode()

View file

@ -133,9 +133,9 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode,TexMode1 &
mode.min_filter += 4; // take equivalent forced linear
int filt = newmode.min_filter;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, c_MinLinearFilter[filt & (((newmode1.max_lod >> 4) > 0)?7:4)]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, newmode1.min_lod >> 4);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, newmode1.max_lod >> 4);
//glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, (newmode.lod_bias/2.0f));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, newmode1.min_lod >> 5);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, newmode1.max_lod >> 5);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, (newmode.lod_bias/32.0f));
}
else
@ -460,7 +460,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
{
if(UseNativeMips)
{
gluBuild2DMipmaps(target, gl_iformat, width, height, gl_format, gl_type, temp);
glTexImage2D(target, 0, gl_iformat, width, height, 0, gl_format, gl_type, temp);
}
else
{
@ -509,9 +509,14 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
{
if (expandedWidth != (int)currentWidth)
glPixelStorei(GL_UNPACK_ROW_LENGTH, expandedWidth);
glTexSubImage2D(target, level,0,0,currentWidth, currentHeight, gl_format, gl_type, temp);
if(skip_texture_create)
{
glTexSubImage2D(target, level,0,0,currentWidth, currentWidth, gl_format, gl_type, temp);
}
else
{
glTexImage2D(target, level, gl_iformat, currentWidth, currentHeight, 0, gl_format, gl_type, temp);
}
if (expandedWidth != (int)currentWidth)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}