Small fix for the last commit, and a little fix for disable fog to really disable it :)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4662 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a1d612e946
commit
0bc7fa7bf5
|
@ -281,7 +281,8 @@ void BPWritten(const BPCmd& bp)
|
|||
PixelShaderManager::SetFogParamChanged();
|
||||
break;
|
||||
case BPMEM_FOGCOLOR: // Fog Color
|
||||
PixelShaderManager::SetFogColorChanged();
|
||||
if (!GetConfig(CONFIG_DISABLEFOG))
|
||||
PixelShaderManager::SetFogColorChanged();
|
||||
break;
|
||||
case BPMEM_ALPHACOMPARE: // Compare Alpha Values
|
||||
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alphaFunc.ref0,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "Statistics.h"
|
||||
#include "PixelShaderManager.h"
|
||||
#include "VideoCommon.h"
|
||||
#include "VideoConfig.h"
|
||||
|
||||
static int s_nColorsChanged[2]; // 0 - regular colors, 1 - k colors
|
||||
static int s_nIndTexMtxChanged;
|
||||
|
@ -203,9 +204,16 @@ void PixelShaderManager::SetConstants()
|
|||
|
||||
if (s_bFogParamChanged)
|
||||
{
|
||||
float a = bpmem.fog.a.GetA() * ((float)(1 << bpmem.fog.b_shift));
|
||||
float b = ((float)bpmem.fog.b_magnitude / 8388638) * ((float)(1 << (bpmem.fog.b_shift - 1)));
|
||||
SetPSConstant4f(C_FOG + 1, a, b, bpmem.fog.c_proj_fsel.GetC(), 0);
|
||||
if(!g_ActiveConfig.bDisableFog)
|
||||
{
|
||||
float a = bpmem.fog.a.GetA() * ((float)(1 << bpmem.fog.b_shift));
|
||||
float b = ((float)bpmem.fog.b_magnitude / 8388638) * ((float)(1 << (bpmem.fog.b_shift - 1)));
|
||||
SetPSConstant4f(C_FOG + 1, a, b, bpmem.fog.c_proj_fsel.GetC(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPSConstant4f(C_FOG + 1, 0.0, 1.0, 1.0, 0);
|
||||
}
|
||||
s_bFogParamChanged = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -465,14 +465,14 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0; x < width; x += 8)
|
||||
for (int iy = 0; iy < 8; iy++, src += 4)
|
||||
decodebytesC4_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, src, tlutaddr);
|
||||
decodebytesC4_5A3_To_BGRA32(((u32*)((u8*)dst + (y + iy) * Pitch)) + x, src, tlutaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0; x < width; x += 8)
|
||||
for (int iy = 0; iy < 8; iy++, src += 4)
|
||||
decodebytesC4_To_Raw16((u16*)dst + (y + iy) * width + x, src, tlutaddr);
|
||||
decodebytesC4_To_Raw16(((u16*)((u8*)dst + (y + iy) * Pitch)) + x, src, tlutaddr);
|
||||
}
|
||||
return GetPCFormatFromTLUTFormat(tlutfmt);
|
||||
case GX_TF_I4:
|
||||
|
@ -483,8 +483,8 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int ix = 0; ix < 4; ix++)
|
||||
{
|
||||
int val = src[ix];
|
||||
dst[(y + iy) * width + x + ix * 2] = Convert4To8(val >> 4);
|
||||
dst[(y + iy) * width + x + ix * 2 + 1] = Convert4To8(val & 0xF);
|
||||
dst[(y + iy) * Pitch + x + ix * 2] = Convert4To8(val >> 4);
|
||||
dst[(y + iy) * Pitch + x + ix * 2 + 1] = Convert4To8(val & 0xF);
|
||||
}
|
||||
}
|
||||
return PC_TEX_FMT_I4_AS_I8;
|
||||
|
@ -493,7 +493,7 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0; x < width; x += 8)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
memcpy(dst + (y + iy)*width+x, src, 8);
|
||||
memcpy((u8*)dst + (y + iy)*Pitch+x, src, 8);
|
||||
}
|
||||
return PC_TEX_FMT_I8;
|
||||
case GX_TF_C8:
|
||||
|
@ -503,14 +503,14 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0; x < width; x += 8)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
decodebytesC8_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, src, tlutaddr);
|
||||
decodebytesC8_5A3_To_BGRA32(((u32*)((u8*)dst + (y + iy) * Pitch)) + x, src, tlutaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0; x < width; x += 8)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
decodebytesC8_To_Raw16((u16*)dst + (y + iy) * width + x, src, tlutaddr);
|
||||
decodebytesC8_To_Raw16(((u16*)((u8*)dst + (y + iy) * Pitch)) + x, src, tlutaddr);
|
||||
}
|
||||
return GetPCFormatFromTLUTFormat(tlutfmt);
|
||||
case GX_TF_IA4:
|
||||
|
@ -518,7 +518,7 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0; x < width; x += 8)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
decodebytesIA4((u16*)dst + (y + iy) * width + x, src);
|
||||
decodebytesIA4(((u16*)((u8*)dst + (y + iy) * Pitch)) + x, src);
|
||||
}
|
||||
return PC_TEX_FMT_IA4_AS_IA8;
|
||||
case GX_TF_IA8:
|
||||
|
@ -527,7 +527,7 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int x = 0; x < width; x += 4)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
{
|
||||
u16 *ptr = (u16 *)dst + (y + iy) * width + x;
|
||||
u16 *ptr = ((u16 *)((u8*)dst + (y + iy) * Pitch)) + x;
|
||||
u16 *s = (u16 *)src;
|
||||
for(int j = 0; j < 4; j++)
|
||||
*ptr++ = Common::swap16(*s++);
|
||||
|
@ -542,14 +542,14 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0; x < width; x += 4)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
decodebytesC14X2_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, (u16*)src, tlutaddr);
|
||||
decodebytesC14X2_5A3_To_BGRA32(((u32*)((u8*)dst + (y + iy) * Pitch)) + x, (u16*)src, tlutaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0; x < width; x += 4)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
decodebytesC14X2_To_Raw16((u16*)dst + (y + iy) * width + x, (u16*)src, tlutaddr);
|
||||
decodebytesC14X2_To_Raw16(((u16*)((u8*)dst + (y + iy) * Pitch)) + x, (u16*)src, tlutaddr);
|
||||
}
|
||||
return GetPCFormatFromTLUTFormat(tlutfmt);
|
||||
case GX_TF_RGB565:
|
||||
|
@ -558,7 +558,7 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int x = 0; x < width; x += 4)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
{
|
||||
u16 *ptr = (u16 *)dst + (y + iy) * width + x;
|
||||
u16 *ptr = ((u16 *)(dst + (y + iy) * Pitch)) + x;
|
||||
u16 *s = (u16 *)src;
|
||||
for(int j = 0; j < 4; j++)
|
||||
*ptr++ = Common::swap16(*s++);
|
||||
|
@ -571,7 +571,7 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int x = 0; x < width; x += 4)
|
||||
for (int iy = 0; iy < 4; iy++, src += 8)
|
||||
//decodebytesRGB5A3((u32*)dst+(y+iy)*width+x, (u16*)src, 4);
|
||||
decodebytesRGB5A3((u32*)dst+(y+iy)*width+x, (u16*)src);
|
||||
decodebytesRGB5A3(((u32*)((u8*)dst+(y+iy)*Pitch))+x, (u16*)src);
|
||||
}
|
||||
return PC_TEX_FMT_BGRA32;
|
||||
case GX_TF_RGBA8: // speed critical
|
||||
|
@ -580,7 +580,7 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
for (int x = 0; x < width; x += 4)
|
||||
{
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
decodebytesARGB8_4((u32*)dst + (y+iy)*width + x, (u16*)src + 4 * iy, (u16*)src + 4 * iy + 16);
|
||||
decodebytesARGB8_4(((u32*)((u8*)dst + (y+iy)*Pitch)) + x, (u16*)src + 4 * iy, (u16*)src + 4 * iy + 16);
|
||||
src += 64;
|
||||
}
|
||||
}
|
||||
|
@ -611,13 +611,13 @@ PC_TexFormat TexDecoder_DirectDecode_real(u8 *dst, const u8 *src, int width, int
|
|||
{
|
||||
for (int x = 0; x < width; x += 8)
|
||||
{
|
||||
decodeDXTBlock((u32*)dst + y * width + x, (DXTBlock*)src, width);
|
||||
decodeDXTBlock(((u32*)((u8*)dst + y * Pitch)) + x, (DXTBlock*)src, width);
|
||||
src += sizeof(DXTBlock);
|
||||
decodeDXTBlock((u32*)dst + y * width + x + 4, (DXTBlock*)src, width);
|
||||
decodeDXTBlock(((u32*)((u8*)dst + y * Pitch)) + x + 4, (DXTBlock*)src, width);
|
||||
src += sizeof(DXTBlock);
|
||||
decodeDXTBlock((u32*)dst + (y + 4) * width + x, (DXTBlock*)src, width);
|
||||
decodeDXTBlock(((u32*)((u8*)dst + (y + 4) * Pitch)) + x, (DXTBlock*)src, width);
|
||||
src += sizeof(DXTBlock);
|
||||
decodeDXTBlock((u32*)dst + (y + 4) * width + x + 4, (DXTBlock*)src, width);
|
||||
decodeDXTBlock(((u32*)((u8*)dst + (y + 4) * Pitch)) + x + 4, (DXTBlock*)src, width);
|
||||
src += sizeof(DXTBlock);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -835,7 +835,6 @@ void UpdateViewport()
|
|||
int Y = (int)(ceil(xfregs.rawViewport[4] + xfregs.rawViewport[1] - (scissorYOff)) * MValueY);
|
||||
int Width = (int)ceil((int)(2 * xfregs.rawViewport[0]) * MValueX);
|
||||
int Height = (int)ceil((int)(-2 * xfregs.rawViewport[1]) * MValueY);
|
||||
|
||||
if(Width < 0)
|
||||
{
|
||||
X += Width;
|
||||
|
@ -863,20 +862,6 @@ void UpdateViewport()
|
|||
//some games set invalids values for z min and z max so fix them to the max an min alowed and let the shaders do this work
|
||||
vp.MinZ = 0.0f;//(xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777216.0f;
|
||||
vp.MaxZ =1.0f;// xfregs.rawViewport[5] / 16777216.0f;
|
||||
/*if(vp.MinZ < 0.0f)
|
||||
vp.MinZ = 0.0f;
|
||||
if(vp.MinZ > 1.0f)
|
||||
vp.MinZ = 1.0f;
|
||||
if(vp.MaxZ < 0.0f)
|
||||
vp.MaxZ = 0.0f;
|
||||
if(vp.MaxZ > 1.0f)
|
||||
vp.MaxZ = 1.0f;
|
||||
if(vp.MinZ > vp.MaxZ)
|
||||
{
|
||||
float temp = vp.MinZ;
|
||||
vp.MinZ = vp.MaxZ;
|
||||
vp.MaxZ = temp;
|
||||
}*/
|
||||
D3D::dev->SetViewport(&vp);
|
||||
}
|
||||
|
||||
|
@ -918,7 +903,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
|||
// 2 - reverse subtract enable (else add)
|
||||
// 3-5 - srcRGB function
|
||||
// 6-8 - dstRGB function
|
||||
if(bpmem.blendmode.logicopenable)
|
||||
if(bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3)
|
||||
return;
|
||||
u32 newval = bpmem.blendmode.subtract << 2;
|
||||
|
||||
|
@ -1043,8 +1028,9 @@ void Renderer::SetDepthMode()
|
|||
|
||||
void Renderer::SetLogicOpMode()
|
||||
{
|
||||
if (bpmem.blendmode.logicopenable)
|
||||
if (bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3)
|
||||
{
|
||||
s_blendMode = 0;
|
||||
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
|
||||
D3D::SetRenderState(D3DRS_BLENDOP, d3dLogincOPop[bpmem.blendmode.logicmode]);
|
||||
D3D::SetRenderState(D3DRS_SRCBLEND, d3dLogicOpSrcFactors[bpmem.blendmode.logicmode]);
|
||||
|
|
|
@ -219,7 +219,7 @@ void TextureCache::Cleanup()
|
|||
d3d_fmt = D3DFMT_A8L8;
|
||||
break;
|
||||
case PC_TEX_FMT_I8:
|
||||
case PC_TEX_FMT_I4_AS_I8:
|
||||
case PC_TEX_FMT_I4_AS_I8:
|
||||
d3d_fmt = D3DFMT_A8L8;
|
||||
break;
|
||||
case PC_TEX_FMT_IA8:
|
||||
|
@ -251,6 +251,7 @@ void TextureCache::Cleanup()
|
|||
}
|
||||
D3DLOCKED_RECT Lock;
|
||||
entry.texture->LockRect(0, &Lock, NULL, 0);
|
||||
if(pcfmt != PC_TEX_FMT_I8 && pcfmt != PC_TEX_FMT_I4_AS_I8)
|
||||
TexDecoder_DirectDecode((u8*)Lock.pBits,ptr,expandedWidth,height,Lock.Pitch,tex_format,tlutaddr,tlutfmt);
|
||||
entry.texture->UnlockRect(0);
|
||||
entry.frameCount = frameCount;
|
||||
|
@ -442,7 +443,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
|||
|
||||
DEBUGGER_PAUSE_LOG_AT(NEXT_NEW_TEXTURE,true,{printf("A new texture (%d x %d) is loaded", width, height);});
|
||||
return &entry;
|
||||
}
|
||||
}
|
||||
void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect)
|
||||
{
|
||||
int efb_w = source_rect.GetWidth();
|
||||
|
|
|
@ -1413,7 +1413,7 @@ void Renderer::SetDepthMode()
|
|||
|
||||
void Renderer::SetLogicOpMode()
|
||||
{
|
||||
if (bpmem.blendmode.logicopenable)
|
||||
if (bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3)
|
||||
{
|
||||
glEnable(GL_COLOR_LOGIC_OP);
|
||||
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
|
||||
|
|
Loading…
Reference in New Issue