Add hires texture support to OpenGL

Currently still only dumps files as .tga but supports loading as .png, .bmp,.tga , .dds

This is by  baby.lueshi

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3166 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid
2009-05-07 07:43:56 +00:00
parent e4e1367045
commit d0304dc997
25 changed files with 4344 additions and 868 deletions

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -35,6 +35,7 @@ static bool s_bFogColorChanged;
static bool s_bFogParamChanged;
static float lastDepthRange[2] = {0}; // 0 = far z, 1 = far - near
static float lastRGBAfull[2][4][4];
static float lastCustomTexScale[8][2];
static u8 s_nTexDimsChanged;
static u8 s_nIndTexScaleChanged;
static u32 lastAlpha = 0;
@ -55,6 +56,8 @@ void PixelShaderManager::Init()
s_bAlphaChanged = s_bZBiasChanged = s_bZTextureTypeChanged = s_bDepthRangeChanged = true;
s_bFogColorChanged = s_bFogParamChanged = true;
memset(lastRGBAfull, 0, sizeof(lastRGBAfull));
for (int i = 0; i < 8; i++)
lastCustomTexScale[i][0] = lastCustomTexScale[i][1] = 1.0f;
}
void PixelShaderManager::Shutdown()
@ -186,6 +189,8 @@ void PixelShaderManager::SetConstants()
SetPSConstant4f(C_FOG + 1, a, b, bpmem.fog.c_proj_fsel.GetC(), 0);
s_bFogParamChanged = false;
}
for (int i = 0; i < 8; i++)
lastCustomTexScale[i][0] = lastCustomTexScale[i][1] = 1.0f;
}
void PixelShaderManager::SetPSTextureDims(int texid)
@ -198,15 +203,15 @@ void PixelShaderManager::SetPSTextureDims(int texid)
TCoordInfo& tc = bpmem.texcoords[texid];
fdims[0] = (float)(lastTexDims[texid]&0xffff);
fdims[1] = (float)((lastTexDims[texid]>>16)&0xfff);
fdims[2] = (float)(tc.s.scale_minus_1+1);
fdims[3] = (float)(tc.t.scale_minus_1+1);
fdims[2] = (float)(tc.s.scale_minus_1+1)*lastCustomTexScale[texid][0];
fdims[3] = (float)(tc.t.scale_minus_1+1)*lastCustomTexScale[texid][1];
}
else {
TCoordInfo& tc = bpmem.texcoords[texid];
fdims[0] = 1.0f/(float)(lastTexDims[texid]&0xffff);
fdims[1] = 1.0f/(float)((lastTexDims[texid]>>16)&0xfff);
fdims[2] = (float)(tc.s.scale_minus_1+1);
fdims[3] = (float)(tc.t.scale_minus_1+1);
fdims[2] = (float)(tc.s.scale_minus_1+1)*lastCustomTexScale[texid][0];
fdims[3] = (float)(tc.t.scale_minus_1+1)*lastCustomTexScale[texid][1];
}
PRIM_LOG("texdims%d: %f %f %f %f\n", texid, fdims[0], fdims[1], fdims[2], fdims[3]);
@ -253,6 +258,12 @@ void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height, u32 wra
}
}
void PixelShaderManager::SetCustomTexScale(int texmapid, float x, float y)
{
lastCustomTexScale[texmapid][0] = x;
lastCustomTexScale[texmapid][1] = y;
}
void PixelShaderManager::SetZTextureBias(u32 bias)
{
if (lastZBias != bias) {