summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
diff options
context:
space:
mode:
authordeath2droid <death2droid@gmail.com>2009-05-07 07:43:56 +0000
committerdeath2droid <death2droid@gmail.com>2009-05-07 07:43:56 +0000
commitd0304dc997c46444b56d4f23f2c1f86e67639eff (patch)
treed8db87b1c69eb4fc230f2ea4c8715eb97eb98fcf /Source/Core/VideoCommon/Src/PixelShaderManager.cpp
parente4e1367045b53b23b534b1e46de4329863ac37a8 (diff)
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
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderManager.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderManager.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
index f2ead54b32..49200f401b 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp
@@ -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) {