mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge branch 'master' into GLSL-master
Conflicts: CMakeLists.txt Source/Core/DolphinWX/Dolphin.vcxproj Source/Core/DolphinWX/Src/GLInterface/WX.cpp Source/Core/DolphinWX/Src/GLInterface/WX.h Source/Core/VideoCommon/Src/TextureCacheBase.cpp Source/Core/VideoCommon/Src/TextureCacheBase.h Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp Source/Plugins/Plugin_VideoDX11/Src/TextureCache.h Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h Source/Plugins/Plugin_VideoOGL/Src/Render.cpp Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp Source/Plugins/Plugin_VideoOGL/Src/TextureCache.h Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp damn mipmap_fixes ...
This commit is contained in:
@ -135,11 +135,10 @@ void SWBPWritten(int address, int newvalue)
|
||||
// AR and GB tiles are stored in separate TMEM banks => can't use a single memcpy for everything
|
||||
u32 tmem_addr_odd = tmem_cfg.preload_tmem_odd * TMEM_LINE_SIZE;
|
||||
|
||||
for (int i = 0; i < tmem_cfg.preload_tile_info.count; ++i)
|
||||
for (unsigned int i = 0; i < tmem_cfg.preload_tile_info.count; ++i)
|
||||
{
|
||||
// FIXME: Duplicate conditions
|
||||
if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE ||
|
||||
tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE)
|
||||
tmem_addr_odd + TMEM_LINE_SIZE > TMEM_SIZE)
|
||||
break;
|
||||
|
||||
memcpy(texMem + tmem_addr_even, src_ptr, TMEM_LINE_SIZE);
|
||||
|
@ -33,7 +33,7 @@ namespace HwRasterizer
|
||||
float efbHalfHeight;
|
||||
bool hasTexture;
|
||||
|
||||
u8 *temp;
|
||||
u8 *temp;
|
||||
|
||||
// Programs
|
||||
static GLuint colProg, texProg, clearProg;
|
||||
@ -61,7 +61,7 @@ namespace HwRasterizer
|
||||
" gl_FragColor = " TEXFUNC "(Texture, TexCoordOut.xy);\n"
|
||||
"}\n";
|
||||
// Clear shader
|
||||
static const char *fragclearText =
|
||||
static const char *fragclearText =
|
||||
"uniform " PREC " vec4 Color;\n"
|
||||
"void main() {\n"
|
||||
" gl_FragColor = Color;\n"
|
||||
@ -75,7 +75,7 @@ namespace HwRasterizer
|
||||
" gl_Position = pos;\n"
|
||||
" TexCoordOut = TexCoordIn;\n"
|
||||
"}\n";
|
||||
static const char *vertclearText =
|
||||
static const char *vertclearText =
|
||||
"attribute vec4 pos;\n"
|
||||
"void main() {\n"
|
||||
" gl_Position = pos;\n"
|
||||
@ -92,11 +92,11 @@ namespace HwRasterizer
|
||||
|
||||
// Color attributes
|
||||
col_apos = glGetAttribLocation(colProg, "pos");
|
||||
col_atex = glGetAttribLocation(colProg, "TexCoordIn");
|
||||
col_atex = glGetAttribLocation(colProg, "TexCoordIn");
|
||||
// Texture attributes
|
||||
tex_apos = glGetAttribLocation(texProg, "pos");
|
||||
tex_atex = glGetAttribLocation(texProg, "TexCoordIn");
|
||||
tex_utex = glGetUniformLocation(texProg, "Texture");
|
||||
tex_atex = glGetAttribLocation(texProg, "TexCoordIn");
|
||||
tex_utex = glGetUniformLocation(texProg, "Texture");
|
||||
// Clear attributes
|
||||
clear_apos = glGetAttribLocation(clearProg, "pos");
|
||||
clear_ucol = glGetUniformLocation(clearProg, "Color");
|
||||
@ -131,7 +131,7 @@ namespace HwRasterizer
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glEnable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
@ -179,7 +179,7 @@ namespace HwRasterizer
|
||||
hasTexture = bpmem.tevorders[0].enable0;
|
||||
|
||||
if (hasTexture)
|
||||
LoadTexture();
|
||||
LoadTexture();
|
||||
}
|
||||
|
||||
void EndTriangles()
|
||||
@ -204,15 +204,15 @@ namespace HwRasterizer
|
||||
float z2 = v2->screenPosition.z / (float)0x00ffffff;
|
||||
|
||||
float r0 = v0->color[0][OutputVertexData::RED_C] / 255.0f;
|
||||
float g0 = v0->color[0][OutputVertexData::GRN_C] / 255.0f;
|
||||
float g0 = v0->color[0][OutputVertexData::GRN_C] / 255.0f;
|
||||
float b0 = v0->color[0][OutputVertexData::BLU_C] / 255.0f;
|
||||
|
||||
float r1 = v1->color[0][OutputVertexData::RED_C] / 255.0f;
|
||||
float g1 = v1->color[0][OutputVertexData::GRN_C] / 255.0f;
|
||||
float g1 = v1->color[0][OutputVertexData::GRN_C] / 255.0f;
|
||||
float b1 = v1->color[0][OutputVertexData::BLU_C] / 255.0f;
|
||||
|
||||
float r2 = v2->color[0][OutputVertexData::RED_C] / 255.0f;
|
||||
float g2 = v2->color[0][OutputVertexData::GRN_C] / 255.0f;
|
||||
float g2 = v2->color[0][OutputVertexData::GRN_C] / 255.0f;
|
||||
float b2 = v2->color[0][OutputVertexData::BLU_C] / 255.0f;
|
||||
|
||||
static const GLfloat verts[3][3] = {
|
||||
@ -339,17 +339,17 @@ namespace HwRasterizer
|
||||
texImage3.hex = texUnit.texImage3[0].hex;
|
||||
texTlut.hex = texUnit.texTlut[0].hex;
|
||||
|
||||
int width = texImage0.width;
|
||||
int height = texImage0.height;
|
||||
int image_width = texImage0.width;
|
||||
int image_height = texImage0.height;
|
||||
|
||||
DebugUtil::GetTextureBGRA(temp, 0, 0, width, height);
|
||||
DebugUtil::GetTextureBGRA(temp, 0, 0, image_width, image_height);
|
||||
|
||||
glGenTextures(1, (GLuint *)&texture);
|
||||
glBindTexture(TEX2D, texture);
|
||||
#ifdef USE_GLES
|
||||
glTexImage2D(TEX2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp);
|
||||
glTexImage2D(TEX2D, 0, GL_RGBA, (GLsizei)image_width, (GLsizei)image_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp);
|
||||
#else
|
||||
glTexImage2D(TEX2D, 0, GL_RGBA8, (GLsizei)width, (GLsizei)height, 0, GL_BGRA, GL_UNSIGNED_BYTE, temp);
|
||||
glTexImage2D(TEX2D, 0, GL_RGBA8, (GLsizei)image_width, (GLsizei)image_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, temp);
|
||||
#endif
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
|
||||
if (z < 0 || z > 0x00ffffff)
|
||||
return;
|
||||
|
||||
if (bpmem.zcontrol.early_ztest && bpmem.zmode.testenable)
|
||||
if (bpmem.zcontrol.early_ztest && bpmem.zmode.testenable && g_SWVideoConfig.bZComploc)
|
||||
{
|
||||
// early z
|
||||
if (!EfbInterface::ZCompare(x, y, z))
|
||||
@ -369,7 +369,7 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer
|
||||
float w[3] = { 1.0f / v0->projectedPosition.w, 1.0f / v1->projectedPosition.w, 1.0f / v2->projectedPosition.w };
|
||||
InitSlope(&WSlope, w[0], w[1], w[2], fltdx31, fltdx12, fltdy12, fltdy31);
|
||||
|
||||
if (!bpmem.genMode.zfreeze)
|
||||
if (!bpmem.genMode.zfreeze || !g_SWVideoConfig.bZFreeze)
|
||||
InitSlope(&ZSlope, v0->screenPosition[2], v1->screenPosition[2], v2->screenPosition[2], fltdx31, fltdx12, fltdy12, fltdy31);
|
||||
|
||||
for(unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
|
||||
|
@ -35,6 +35,9 @@ SWVideoConfig::SWVideoConfig()
|
||||
bDumpObjects = false;
|
||||
bDumpFrames = false;
|
||||
|
||||
bZComploc = true;
|
||||
bZFreeze = true;
|
||||
|
||||
bDumpTevStages = false;
|
||||
bDumpTevTextureFetches = false;
|
||||
|
||||
@ -52,6 +55,8 @@ void SWVideoConfig::Load(const char* ini_file)
|
||||
iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false);
|
||||
|
||||
iniFile.Get("Rendering", "HwRasterizer", &bHwRasterizer, false);
|
||||
iniFile.Get("Rendering", "ZComploc", &bZComploc, true);
|
||||
iniFile.Get("Rendering", "ZFreeze", &bZFreeze, true);
|
||||
|
||||
iniFile.Get("Info", "ShowStats", &bShowStats, false);
|
||||
|
||||
@ -74,6 +79,8 @@ void SWVideoConfig::Save(const char* ini_file)
|
||||
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
|
||||
|
||||
iniFile.Set("Rendering", "HwRasterizer", bHwRasterizer);
|
||||
iniFile.Set("Rendering", "ZComploc", &bZComploc);
|
||||
iniFile.Set("Rendering", "ZFreeze", &bZFreeze);
|
||||
|
||||
iniFile.Set("Info", "ShowStats", bShowStats);
|
||||
|
||||
|
@ -36,6 +36,10 @@ struct SWVideoConfig : NonCopyable
|
||||
|
||||
bool bHwRasterizer;
|
||||
|
||||
// Emulation features
|
||||
bool bZComploc;
|
||||
bool bZFreeze;
|
||||
|
||||
bool bShowStats;
|
||||
|
||||
bool bDumpTextures;
|
||||
|
@ -142,7 +142,6 @@ void VideoSoftware::Video_Prepare()
|
||||
{
|
||||
GLInterface->MakeCurrent();
|
||||
// Init extension support.
|
||||
{
|
||||
#ifndef USE_GLES
|
||||
#ifdef __APPLE__
|
||||
glewExperimental = 1;
|
||||
@ -151,21 +150,9 @@ void VideoSoftware::Video_Prepare()
|
||||
ERROR_LOG(VIDEO, "glewInit() failed!Does your video card support OpenGL 2.x?");
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle VSync on/off
|
||||
#ifdef _WIN32
|
||||
if (WGLEW_EXT_swap_control)
|
||||
wglSwapIntervalEXT(VSYNC_ENABLED);
|
||||
else
|
||||
ERROR_LOG(VIDEO, "no support for SwapInterval (framerate clamped to monitor refresh rate)Does your video card support OpenGL 2.x?");
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
if (glXSwapIntervalSGI)
|
||||
glXSwapIntervalSGI(VSYNC_ENABLED);
|
||||
else
|
||||
ERROR_LOG(VIDEO, "no support for SwapInterval (framerate clamped to monitor refresh rate)");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
// Handle VSync on/off
|
||||
GLInterface->SwapInterval(VSYNC_ENABLED);
|
||||
|
||||
HwRasterizer::Prepare();
|
||||
SWRenderer::Prepare();
|
||||
|
@ -431,7 +431,7 @@ static bool AlphaCompare(int alpha, int ref, int comp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool AlphaTest(int alpha)
|
||||
static bool TevAlphaTest(int alpha)
|
||||
{
|
||||
bool comp0 = AlphaCompare(alpha, bpmem.alpha_test.ref0, bpmem.alpha_test.comp0);
|
||||
bool comp1 = AlphaCompare(alpha, bpmem.alpha_test.ref1, bpmem.alpha_test.comp1);
|
||||
@ -700,7 +700,7 @@ void Tev::Draw()
|
||||
// convert to 8 bits per component
|
||||
u8 output[4] = {(u8)Reg[0][ALP_C], (u8)Reg[0][BLU_C], (u8)Reg[0][GRN_C], (u8)Reg[0][RED_C]};
|
||||
|
||||
if (!AlphaTest(output[ALP_C]))
|
||||
if (!TevAlphaTest(output[ALP_C]))
|
||||
return;
|
||||
|
||||
// z texture
|
||||
@ -784,11 +784,12 @@ void Tev::Draw()
|
||||
output[BLU_C] = (output[BLU_C] * invFog + fogInt * bpmem.fog.color.b) >> 8;
|
||||
}
|
||||
|
||||
if (!bpmem.zcontrol.early_ztest && bpmem.zmode.testenable)
|
||||
{
|
||||
if (!EfbInterface::ZCompare(Position[0], Position[1], Position[2]))
|
||||
return;
|
||||
}
|
||||
bool late_ztest = !bpmem.zcontrol.early_ztest || !g_SWVideoConfig.bZComploc;
|
||||
if (late_ztest && bpmem.zmode.testenable)
|
||||
{
|
||||
if (!EfbInterface::ZCompare(Position[0], Position[1], Position[2]))
|
||||
return;
|
||||
}
|
||||
|
||||
#if ALLOW_TEV_DUMPS
|
||||
if (g_SWVideoConfig.bDumpTevStages)
|
||||
|
Reference in New Issue
Block a user