diff options
| author | degasus <wickmarkus@web.de> | 2013-01-24 16:58:28 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2013-01-24 16:58:28 +0100 |
| commit | e0ffdda26e5fb34b2f0d59d5d45b0deda9c90c19 (patch) | |
| tree | 8e289ea93c97fe7430ae501200b60327f572c7e2 /Source/Plugins | |
| parent | d5748ebaef93cd601ae6ab5e12f39dd201593ad0 (diff) | |
| parent | d60cc373d1b389215eb63c4e20fe24e902680c7a (diff) | |
Merge branch 'immediate-removal' into GLSL-master
Conflicts:
Source/Core/VideoCommon/Src/PixelShaderGen.cpp
Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp
immediate-removal is a new created branch seperated from master but reverted the revert of immediate-removal
so we get less conflicts by merging
Diffstat (limited to 'Source/Plugins')
14 files changed, 143 insertions, 113 deletions
diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 830f16a9f6..44eaaf5dcf 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -471,10 +471,13 @@ void Renderer::SetColorMask() { // Only enable alpha channel if it's supported by the current EFB format UINT8 color_mask = 0; - if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) - color_mask = D3D11_COLOR_WRITE_ENABLE_ALPHA; - if (bpmem.blendmode.colorupdate) - color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE; + if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL) + { + if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) + color_mask = D3D11_COLOR_WRITE_ENABLE_ALPHA; + if (bpmem.blendmode.colorupdate) + color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE; + } gx_state.blenddc.RenderTarget[0].RenderTargetWriteMask = color_mask; } @@ -907,10 +910,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons Core::Callback_VideoCopiedToXFB(false); return; } - // this function is called after the XFB field is changed, not after - // EFB is copied to XFB. In this way, flickering is reduced in games - // and seems to also give more FPS in ZTP + if (field == FIELD_LOWER) xfbAddr -= fbWidth * 2; u32 xfbCount = 0; const XFBSourceBase* const* xfbSourceList = FramebufferManager::GetXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount); if ((!xfbSourceList || xfbCount == 0) && g_ActiveConfig.bUseXFB && !g_ActiveConfig.bUseRealXFB) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 4e8f6ee68a..1738c015e1 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -432,10 +432,13 @@ void Renderer::SetColorMask() { // Only enable alpha channel if it's supported by the current EFB format DWORD color_mask = 0; - if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) - color_mask = D3DCOLORWRITEENABLE_ALPHA; - if (bpmem.blendmode.colorupdate) - color_mask |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE; + if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL) + { + if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) + color_mask = D3DCOLORWRITEENABLE_ALPHA; + if (bpmem.blendmode.colorupdate) + color_mask |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE; + } D3D::SetRenderState(D3DRS_COLORWRITEENABLE, color_mask); } @@ -848,9 +851,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons Core::Callback_VideoCopiedToXFB(false); return; } - // this function is called after the XFB field is changed, not after - // EFB is copied to XFB. In this way, flickering is reduced in games - // and seems to also give more FPS in ZTP if (field == FIELD_LOWER) xfbAddr -= fbWidth * 2; u32 xfbCount = 0; @@ -1205,6 +1205,7 @@ void Renderer::ApplyState(bool bUseDstAlpha) { if (bUseDstAlpha) { + // TODO: WTF is this crap? We're enabling color writing regardless of the actual GPU state here... D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA); D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false); if(bpmem.zmode.testenable && bpmem.zmode.updateenable) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 8a79cc69fd..64a83d8ae5 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -668,10 +668,13 @@ void Renderer::SetColorMask() { // Only enable alpha channel if it's supported by the current EFB format GLenum ColorMask = GL_FALSE, AlphaMask = GL_FALSE; - if (bpmem.blendmode.colorupdate) - ColorMask = GL_TRUE; - if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) - AlphaMask = GL_TRUE; + if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL) + { + if (bpmem.blendmode.colorupdate) + ColorMask = GL_TRUE; + if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) + AlphaMask = GL_TRUE; + } glColorMask(ColorMask, ColorMask, ColorMask, AlphaMask); } @@ -1036,9 +1039,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons Core::Callback_VideoCopiedToXFB(false); return; } - // this function is called after the XFB field is changed, not after - // EFB is copied to XFB. In this way, flickering is reduced in games - // and seems to also give more FPS in ZTP if (field == FIELD_LOWER) xfbAddr -= fbWidth * 2; u32 xfbCount = 0; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 5c0c164a42..f513038f0f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -245,8 +245,8 @@ void VertexManager::vFlush() xfregs.postMtxInfo[i].index, xfregs.postMtxInfo[i].normalize); } - PRIM_LOG("pixel: tev=%d, ind=%d, texgen=%d, dstalpha=%d, alphafunc=0x%x", bpmem.genMode.numtevstages+1, bpmem.genMode.numindstages, - bpmem.genMode.numtexgens, (u32)bpmem.dstalpha.enable, (bpmem.alphaFunc.hex>>16)&0xff); + PRIM_LOG("pixel: tev=%d, ind=%d, texgen=%d, dstalpha=%d, alphatest=0x%x", bpmem.genMode.numtevstages+1, bpmem.genMode.numindstages, + bpmem.genMode.numtexgens, (u32)bpmem.dstalpha.enable, (bpmem.alpha_test.hex>>16)&0xff); #endif (void)GL_REPORT_ERROR(); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp index 3db8c5d493..f0674a96cc 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/BPMemLoader.cpp @@ -115,18 +115,40 @@ void SWBPWritten(int address, int newvalue) case BPMEM_PRELOAD_MODE: if (newvalue != 0) { - // NOTE(neobrain): Apparently tmemodd doesn't affect hardware behavior at all (libogc uses it just as a buffe$ - BPS_TmemConfig& tmem_cfg = bpmem.tmem_config; - u8* ram_ptr = Memory::GetPointer(tmem_cfg.preload_addr << 5); - u32 tmem_addr = tmem_cfg.preload_tmem_even * TMEM_LINE_SIZE; - u32 size = tmem_cfg.preload_tile_info.count * 32; - - // Check if the game has overflowed TMEM, and copy up to the limit. - // Paper Mario does this when entering the Great Boogly Tree (Chap 2) - if ((tmem_addr + size) > TMEM_SIZE) - size = TMEM_SIZE - tmem_addr; + // TODO: Not quite sure if this is completely correct (likely not) + // NOTE: libogc's implementation of GX_PreloadEntireTexture seems flawed, so it's not necessarily a good reference for RE'ing this feature. - memcpy(texMem + tmem_addr, ram_ptr, size); + BPS_TmemConfig& tmem_cfg = bpmem.tmem_config; + u8* src_ptr = Memory::GetPointer(tmem_cfg.preload_addr << 5); // TODO: Should we add mask here on GC? + u32 size = tmem_cfg.preload_tile_info.count * TMEM_LINE_SIZE; + u32 tmem_addr_even = tmem_cfg.preload_tmem_even * TMEM_LINE_SIZE; + + if (tmem_cfg.preload_tile_info.type != 3) + { + if (tmem_addr_even + size > TMEM_SIZE) + size = TMEM_SIZE - tmem_addr_even; + + memcpy(texMem + tmem_addr_even, src_ptr, size); + } + else // RGBA8 tiles (and CI14, but that might just be stupid libogc!) + { + // 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) + { + // FIXME: Duplicate conditions + if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE || + tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE) + break; + + memcpy(texMem + tmem_addr_even, src_ptr, TMEM_LINE_SIZE); + memcpy(texMem + tmem_addr_odd, src_ptr + TMEM_LINE_SIZE, TMEM_LINE_SIZE); + tmem_addr_even += TMEM_LINE_SIZE; + tmem_addr_odd += TMEM_LINE_SIZE; + src_ptr += TMEM_LINE_SIZE * 2; + } + } } break; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp index 8ee2243719..57fc57a906 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp @@ -62,8 +62,8 @@ void SaveTexture(const char* filename, u32 texmap, s32 mip) TexImage0& ti0 = texUnit.texImage0[subTexmap]; - int width = ti0.width + 1; - int height = ti0.height + 1; + u32 width = ti0.width + 1; + u32 height = ti0.height + 1; u8 *data = new u8[width * height * 4]; @@ -74,19 +74,23 @@ void SaveTexture(const char* filename, u32 texmap, s32 mip) delete []data; } -void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, int width, int height) +void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height) { u8 sample[4]; - for (int y = 0; y < height; y++) - for (int x = 0; x < width; x++) { + for (u32 y = 0; y < height; y++) + { + for (u32 x = 0; x < width; x++) + { TextureSampler::SampleMip(x << 7, y << 7, mip, false, texmap, sample); - // rgba to bgra + + // RGBA to BGRA *(dst++) = sample[2]; *(dst++) = sample[1]; *(dst++) = sample[0]; *(dst++) = sample[3]; } + } } s32 GetMaxTextureLod(u32 texmap) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.h b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.h index 4b2f0b86aa..efb104458d 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.h @@ -22,7 +22,7 @@ namespace DebugUtil { void Init(); - void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, int width, int height); + void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height); void DumpActiveTextures(); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp index c212c93601..45c744ee81 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp @@ -125,7 +125,7 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi) if (z < 0 || z > 0x00ffffff) return; - if (bpmem.zcontrol.zcomploc && bpmem.zmode.testenable) + if (bpmem.zcontrol.early_ztest && bpmem.zmode.testenable) { // early z if (!EfbInterface::ZCompare(x, y, z)) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index dcc773d5a5..91d35af849 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -52,10 +52,10 @@ void CreateShaders() { static const char *fragShaderText = "varying " PREC " vec2 TexCoordOut;\n" - "uniform " TEXTYPE " Texture;\n" + "uniform sampler2D Texture;\n" "void main() {\n" " " PREC " vec4 tmpcolor;\n" - " tmpcolor = " TEXFUNC "(Texture, TexCoordOut);\n" + " tmpcolor = texture2D(Texture, TexCoordOut);\n" " gl_FragColor = tmpcolor;\n" "}\n"; static const char *vertShaderText = @@ -63,7 +63,7 @@ void CreateShaders() "attribute vec2 TexCoordIn;\n " "varying vec2 TexCoordOut;\n " "void main() {\n" - " gl_Position = pos;\n" + " gl_Position = pos;\n" " TexCoordOut = TexCoordIn;\n" "}\n"; @@ -74,6 +74,8 @@ void CreateShaders() uni_tex = glGetUniformLocation(program, "Texture"); attr_pos = glGetAttribLocation(program, "pos"); attr_tex = glGetAttribLocation(program, "TexCoordIn"); + + } void SWRenderer::Prepare() @@ -86,7 +88,7 @@ void SWRenderer::Prepare() // TODO: Enable for GLES once RasterFont supports GLES #ifndef USE_GLES s_pfont = new OGL::RasterFont(); - glEnable(GL_TEXTURE_RECTANGLE_ARB); + glEnable(GL_TEXTURE_2D); #endif GL_REPORT_ERRORD(); } @@ -141,48 +143,37 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height) glViewport(0, 0, glWidth, glHeight); glScissor(0, 0, glWidth, glHeight); - glBindTexture(TEX2D, s_RenderTarget); + glBindTexture(GL_TEXTURE_2D, s_RenderTarget); - glTexImage2D(TEX2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture); - glTexParameteri(TEX2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(TEX2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glUseProgram(program); static const GLfloat verts[4][2] = { { -1, -1}, // Left top { -1, 1}, // left bottom { 1, 1}, // right bottom { 1, -1} // right top }; - //Texture rectangle uses pixel coordinates -#ifndef USE_GLES - GLfloat u_max = (GLfloat)width; - GLfloat v_max = (GLfloat)height; - - static const GLfloat texverts[4][2] = { - {0, v_max}, - {0, 0}, - {u_max, 0}, - {u_max, v_max} - }; -#else static const GLfloat texverts[4][2] = { {0, 1}, {0, 0}, {1, 0}, {1, 1} }; -#endif + glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts); glVertexAttribPointer(attr_tex, 2, GL_FLOAT, GL_FALSE, 0, texverts); glEnableVertexAttribArray(attr_pos); glEnableVertexAttribArray(attr_tex); - glActiveTexture(GL_TEXTURE0); glUniform1i(uni_tex, 0); + glActiveTexture(GL_TEXTURE0); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableVertexAttribArray(attr_pos); glDisableVertexAttribArray(attr_tex); - glBindTexture(TEX2D, 0); + glBindTexture(GL_TEXTURE_2D, 0); GL_REPORT_ERRORD(); } @@ -194,11 +185,8 @@ void SWRenderer::SwapBuffer() GLInterface->Swap(); - swstats.ResetFrame(); + swstats.ResetFrame(); -#ifndef USE_GLES - glClearDepth(1.0f); -#endif glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GL_REPORT_ERRORD(); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWVideoConfig.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWVideoConfig.cpp index 7f7ef6b0f8..05a6cdddf2 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWVideoConfig.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWVideoConfig.cpp @@ -51,7 +51,7 @@ void SWVideoConfig::Load(const char* ini_file) iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false); - iniFile.Get("Rendering", "HwRasterizer", &bHwRasterizer, true); + iniFile.Get("Rendering", "HwRasterizer", &bHwRasterizer, false); iniFile.Get("Info", "ShowStats", &bShowStats, false); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index ae2a4db3f5..4c88a89ab6 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -70,7 +70,7 @@ void VideoSoftware::ShowConfig(void *_hParent) bool VideoSoftware::Initialize(void *&window_handle) { - g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); + g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str()); InitInterface(); if (!GLInterface->Create(window_handle)) @@ -79,18 +79,16 @@ bool VideoSoftware::Initialize(void *&window_handle) return false; } - InitBPMemory(); - InitXFMemory(); - SWCommandProcessor::Init(); - SWPixelEngine::Init(); - OpcodeDecoder::Init(); - Clipper::Init(); - Rasterizer::Init(); - if (g_SWVideoConfig.bHwRasterizer) - HwRasterizer::Init(); - else - SWRenderer::Init(); - DebugUtil::Init(); + InitBPMemory(); + InitXFMemory(); + SWCommandProcessor::Init(); + SWPixelEngine::Init(); + OpcodeDecoder::Init(); + Clipper::Init(); + Rasterizer::Init(); + HwRasterizer::Init(); + SWRenderer::Init(); + DebugUtil::Init(); return true; } @@ -134,10 +132,8 @@ void VideoSoftware::EmuStateChange(EMUSTATE_CHANGE newState) void VideoSoftware::Shutdown() { - if (g_SWVideoConfig.bHwRasterizer) - HwRasterizer::Shutdown(); - else - SWRenderer::Shutdown(); + HwRasterizer::Shutdown(); + SWRenderer::Shutdown(); GLInterface->Shutdown(); } @@ -149,9 +145,9 @@ void VideoSoftware::Video_Prepare() { #ifndef USE_GLES if (glewInit() != GLEW_OK) { - ERROR_LOG(VIDEO, "glewInit() failed!Does your video card support OpenGL 2.x?"); - return; - } + ERROR_LOG(VIDEO, "glewInit() failed!Does your video card support OpenGL 2.x?"); + return; + } // Handle VSync on/off #ifdef _WIN32 @@ -168,12 +164,10 @@ void VideoSoftware::Video_Prepare() #endif } - if (g_SWVideoConfig.bHwRasterizer) - HwRasterizer::Prepare(); - else - SWRenderer::Prepare(); + HwRasterizer::Prepare(); + SWRenderer::Prepare(); - INFO_LOG(VIDEO, "Video backend initialized."); + INFO_LOG(VIDEO, "Video backend initialized."); } // Run from the CPU thread (from VideoInterface.cpp) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp index c67ee53837..b10f5a2676 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp @@ -433,10 +433,10 @@ static bool AlphaCompare(int alpha, int ref, int comp) static bool AlphaTest(int alpha) { - bool comp0 = AlphaCompare(alpha, bpmem.alphaFunc.ref0, bpmem.alphaFunc.comp0); - bool comp1 = AlphaCompare(alpha, bpmem.alphaFunc.ref1, bpmem.alphaFunc.comp1); + bool comp0 = AlphaCompare(alpha, bpmem.alpha_test.ref0, bpmem.alpha_test.comp0); + bool comp1 = AlphaCompare(alpha, bpmem.alpha_test.ref1, bpmem.alpha_test.comp1); - switch (bpmem.alphaFunc.logic) { + switch (bpmem.alpha_test.logic) { case 0: return comp0 && comp1; // and case 1: return comp0 || comp1; // or case 2: return comp0 ^ comp1; // xor @@ -784,7 +784,7 @@ void Tev::Draw() output[BLU_C] = (output[BLU_C] * invFog + fogInt * bpmem.fog.color.b) >> 8; } - if (!bpmem.zcontrol.zcomploc && bpmem.zmode.testenable) + if (!bpmem.zcontrol.early_ztest && bpmem.zmode.testenable) { if (!EfbInterface::ZCompare(Position[0], Position[1], Position[2])) return; diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp index 66b6b68e22..56101dc69d 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp @@ -120,10 +120,12 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample) TexImage0& ti0 = texUnit.texImage0[subTexmap]; TexTLUT& texTlut = texUnit.texTlut[subTexmap]; - u8 *imageSrc; + u8 *imageSrc, *imageSrcOdd = NULL; if (texUnit.texImage1[subTexmap].image_type) { imageSrc = &texMem[texUnit.texImage1[subTexmap].tmem_even * TMEM_LINE_SIZE]; + if (ti0.format == GX_TF_RGBA8) + imageSrcOdd = &texMem[texUnit.texImage2[subTexmap].tmem_odd * TMEM_LINE_SIZE]; } else { @@ -190,17 +192,34 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample) WrapCoord(imageSPlus1, tm0.wrap_s, imageWidth); WrapCoord(imageTPlus1, tm0.wrap_t, imageHeight); - TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); - SetTexel(sampledTex, texel, (128 - fractS) * (128 - fractT)); + if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type)) + { + TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); + SetTexel(sampledTex, texel, (128 - fractS) * (128 - fractT)); + + TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); + AddTexel(sampledTex, texel, (fractS) * (128 - fractT)); - TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); - AddTexel(sampledTex, texel, (fractS) * (128 - fractT)); + TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); + AddTexel(sampledTex, texel, (128 - fractS) * (fractT)); - TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); - AddTexel(sampledTex, texel, (128 - fractS) * (fractT)); + TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); + AddTexel(sampledTex, texel, (fractS) * (fractT)); + } + else + { + TexDecoder_DecodeTexelRGBA8FromTmem(sampledTex, imageSrc, imageSrcOdd, imageS, imageT, imageWidth); + SetTexel(sampledTex, texel, (128 - fractS) * (128 - fractT)); - TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); - AddTexel(sampledTex, texel, (fractS) * (fractT)); + TexDecoder_DecodeTexelRGBA8FromTmem(sampledTex, imageSrc, imageSrcOdd, imageSPlus1, imageT, imageWidth); + AddTexel(sampledTex, texel, (fractS) * (128 - fractT)); + + TexDecoder_DecodeTexelRGBA8FromTmem(sampledTex, imageSrc, imageSrcOdd, imageS, imageTPlus1, imageWidth); + AddTexel(sampledTex, texel, (128 - fractS) * (fractT)); + + TexDecoder_DecodeTexelRGBA8FromTmem(sampledTex, imageSrc, imageSrcOdd, imageSPlus1, imageTPlus1, imageWidth); + AddTexel(sampledTex, texel, (fractS) * (fractT)); + } sample[0] = (u8)(texel[0] >> 14); sample[1] = (u8)(texel[1] >> 14); @@ -217,7 +236,10 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample) WrapCoord(imageS, tm0.wrap_s, imageWidth); WrapCoord(imageT, tm0.wrap_t, imageHeight); - TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); + if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type)) + TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format); + else + TexDecoder_DecodeTexelRGBA8FromTmem(sample, imageSrc, imageSrcOdd, imageS, imageT, imageWidth); } } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp index 792d90e61c..bd085a3edf 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/VideoConfigDialog.cpp @@ -21,8 +21,6 @@ #include "FileUtil.h" #include "Core.h" -#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s) - template <typename T> IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& setting, int minVal, int maxVal, long style) : wxSpinCtrl(parent, -1, label, wxDefaultPosition, wxDefaultSize, style), @@ -30,7 +28,7 @@ IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& se { SetRange(minVal, maxVal); SetValue(m_setting); - _connect_macro_(this, IntegerSetting::UpdateValue, wxEVT_COMMAND_SPINCTRL_UPDATED, this); + Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, &IntegerSetting::UpdateValue, this); } @@ -70,7 +68,7 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title, // TODO: How to get the translated plugin name? choice_backend->SetStringSelection(wxString::FromAscii(g_video_backend->GetName().c_str())); - _connect_macro_(choice_backend, VideoConfigDialog::Event_Backend, wxEVT_COMMAND_CHOICE_SELECTED, this); + choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDialog::Event_Backend, this); szr_rendering->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5); szr_rendering->Add(choice_backend, 1, 0, 0); |
