From 4b1a3152b6d0de5baf59771c3ad32ebf6c818864 Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Sat, 17 Jul 2010 23:36:03 +0000 Subject: [PATCH] Plugin_VideoOGL has been using an old duplicate of VertexLoaderManager.cpp. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5895 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/SConscript | 1 + Source/Plugins/Plugin_VideoOGL/Src/SConscript | 1 - .../Src/VertexLoaderManager.cpp | 189 ------------------ .../Plugin_VideoSoftware/Src/SConscript | 4 +- 4 files changed, 3 insertions(+), 192 deletions(-) delete mode 100644 Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.cpp diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index 5c1578fb1b..1889111e43 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -21,6 +21,7 @@ files = [ 'PixelShaderManager.cpp', 'VertexShaderGen.cpp', 'VertexShaderManager.cpp', + 'VertexLoaderManager.cpp', 'VertexLoader.cpp', 'VertexLoader_Color.cpp', 'VertexLoader_Normal.cpp', diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index ba53df28b3..2362e61a98 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -16,7 +16,6 @@ files = [ 'VertexShaderCache.cpp', 'TextureConverter.cpp', 'VertexManager.cpp', - 'VertexLoaderManager.cpp', 'XFB.cpp', 'PostProcessing.cpp', 'FramebufferManager.cpp', diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.cpp deleted file mode 100644 index 02f4f02fd5..0000000000 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.cpp +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (C) 2003 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 -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include -#include -#include - -#include "VideoCommon.h" -#include "Statistics.h" - -#include "VertexShaderManager.h" -#include "VertexLoader.h" -#include "VertexLoaderManager.h" - -static int s_attr_dirty; // bitfield - -static VertexLoader *g_VertexLoaders[8]; - -namespace VertexLoaderManager -{ - -typedef std::map VertexLoaderMap; -static VertexLoaderMap g_VertexLoaderMap; -// TODO - change into array of pointers. Keep a map of all seen so far. - -void Init() -{ - MarkAllDirty(); - for (int i = 0; i < 8; i++) - g_VertexLoaders[i] = NULL; -} - -void Shutdown() -{ - for (VertexLoaderMap::iterator iter = g_VertexLoaderMap.begin(); iter != g_VertexLoaderMap.end(); ++iter) - { - delete iter->second; - } - g_VertexLoaderMap.clear(); -} - -namespace { -struct entry { - std::string text; - u64 num_verts; - bool operator < (const entry &other) const { - return num_verts > other.num_verts; - } -}; -} - -void AppendListToString(std::string *dest) -{ - std::vector entries; - - size_t total_size = 0; - for (VertexLoaderMap::const_iterator iter = g_VertexLoaderMap.begin(); iter != g_VertexLoaderMap.end(); ++iter) - { - entry e; - iter->second->AppendToString(&e.text); - e.num_verts = iter->second->GetNumLoadedVerts(); - entries.push_back(e); - total_size += e.text.size() + 1; - } - sort(entries.begin(), entries.end()); - dest->reserve(dest->size() + total_size); - for (std::vector::const_iterator iter = entries.begin(); iter != entries.end(); ++iter) { - dest->append(iter->text); - } -} - -void MarkAllDirty() -{ - s_attr_dirty = 0xff; -} - -static void RefreshLoader(int vtx_attr_group) -{ - if ((s_attr_dirty >> vtx_attr_group) & 1) - { - VertexLoaderUID uid; - uid.InitFromCurrentState(vtx_attr_group); - VertexLoaderMap::iterator iter = g_VertexLoaderMap.find(uid); - if (iter != g_VertexLoaderMap.end()) - { - g_VertexLoaders[vtx_attr_group] = iter->second; - } - else - { - VertexLoader *loader = new VertexLoader(g_VtxDesc, g_VtxAttr[vtx_attr_group]); - g_VertexLoaderMap[uid] = loader; - g_VertexLoaders[vtx_attr_group] = loader; - INCSTAT(stats.numVertexLoaders); - } - } - s_attr_dirty &= ~(1 << vtx_attr_group); -} - -void RunVertices(int vtx_attr_group, int primitive, int count) -{ - if (!count) - return; - RefreshLoader(vtx_attr_group); - g_VertexLoaders[vtx_attr_group]->RunVertices(vtx_attr_group, primitive, count); -} - -int GetVertexSize(int vtx_attr_group) -{ - RefreshLoader(vtx_attr_group); - return g_VertexLoaders[vtx_attr_group]->GetVertexSize(); -} - -} // namespace - -void LoadCPReg(u32 sub_cmd, u32 value) -{ - switch (sub_cmd & 0xF0) - { - case 0x30: - VertexShaderManager::SetTexMatrixChangedA(value); - break; - - case 0x40: - VertexShaderManager::SetTexMatrixChangedB(value); - break; - - case 0x50: - g_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits - g_VtxDesc.Hex |= value; - s_attr_dirty = 0xFF; - break; - - case 0x60: - g_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits - g_VtxDesc.Hex |= (u64)value << 17; - s_attr_dirty = 0xFF; - break; - - case 0x70: - _assert_((sub_cmd & 0x0F) < 8); - g_VtxAttr[sub_cmd & 7].g0.Hex = value; - s_attr_dirty |= 1 << (sub_cmd & 7); - break; - - case 0x80: - _assert_((sub_cmd & 0x0F) < 8); - g_VtxAttr[sub_cmd & 7].g1.Hex = value; - s_attr_dirty |= 1 << (sub_cmd & 7); - break; - - case 0x90: - _assert_((sub_cmd & 0x0F) < 8); - g_VtxAttr[sub_cmd & 7].g2.Hex = value; - s_attr_dirty |= 1 << (sub_cmd & 7); - break; - - // Pointers to vertex arrays in GC RAM - case 0xA0: - arraybases[sub_cmd & 0xF] = value; - cached_arraybases[sub_cmd & 0xF] = Memory_GetPtr(value); - break; - - case 0xB0: - arraystrides[sub_cmd & 0xF] = value & 0xFF; - break; - } -} - -void RecomputeCachedArraybases() -{ - for (int i = 0; i < 16; i++) - { - cached_arraybases[i] = Memory_GetPtr(arraybases[i]); - } -} diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript index 6a5b762b42..7ee899e44d 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript @@ -39,8 +39,8 @@ libs = [ gfxenv = env.Clone() -if sys.platform == 'darwin': - files += [ 'cocoaGL.m', ] +if sys.platform == 'darwin' and not gfxenv['HAVE_WX']: + files += [ 'cocoaGL.m' ] if sys.platform == 'win32': files += [ 'Win32.cpp' ]