cut dependencies, clean code

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1685 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-12-26 12:24:15 +00:00
parent 974ff690f6
commit afc87eb5ae
7 changed files with 38 additions and 30 deletions

View File

@ -52,4 +52,9 @@ inline float Memory_Read_Float(u32 _uAddress)
return temp.f; return temp.f;
} }
struct TRectangle
{
int left, top, right, bottom;
};
#endif // _VIDEOCOMMON_H #endif // _VIDEOCOMMON_H

View File

@ -16,7 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Globals.h" #include "Globals.h"
#include "GLUtil.h"
#include <stdio.h> #include <stdio.h>
#include <list> #include <list>
@ -74,21 +73,6 @@ bool SaveTGA(const char* filename, int width, int height, void* pdata)
return true; return true;
} }
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height)
{
GL_REPORT_ERRORD();
std::vector<u32> data(width * height);
glBindTexture(textarget, tex);
glGetTexImage(textarget, 0, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]);
GLenum err;
GL_REPORT_ERROR();
if (err != GL_NO_ERROR)
{
return false;
}
return SaveTGA(filename, width, height, &data[0]);
}
bool SaveData(const char* filename, const char* data) bool SaveData(const char* filename, const char* data)
{ {
FILE *f = fopen(filename, "wb"); FILE *f = fopen(filename, "wb");

View File

@ -16,7 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
#include "Globals.h"
#include "Profiler.h" #include "Profiler.h"
#include <cmath> #include <cmath>
@ -24,9 +23,11 @@
#include "Statistics.h" #include "Statistics.h"
#include "Config.h" #include "Config.h"
#include "Render.h"
#include "PixelShaderManager.h" #include "PixelShaderManager.h"
// TODO: move logging to VideoCommon. Until then -
#define PRIM_LOG(x, ...)
static int s_nColorsChanged[2]; // 0 - regular colors, 1 - k colors static int s_nColorsChanged[2]; // 0 - regular colors, 1 - k colors
static int s_nIndTexMtxChanged = 0; static int s_nIndTexMtxChanged = 0;
static bool s_bAlphaChanged; static bool s_bAlphaChanged;

View File

@ -27,7 +27,6 @@ void SetPSConstant4fv(int const_number, const float *f);
// The non-API dependent parts. // The non-API dependent parts.
class PixelShaderManager class PixelShaderManager
{ {
static void SetPSTextureDims(int texid); static void SetPSTextureDims(int texid);
public: public:
static void Init(); static void Init();

View File

@ -18,7 +18,8 @@
#ifndef _TEXTURECONVERTER_H #ifndef _TEXTURECONVERTER_H
#define _TEXTURECONVERTER_H #define _TEXTURECONVERTER_H
#include "TextureMngr.h" #include "VideoCommon.h"
#include "GLutil.h"
// Converts textures between formats // Converts textures between formats
// TODO: support multiple texture formats // TODO: support multiple texture formats

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <vector>
#include "Globals.h" #include "Globals.h"
#ifdef _WIN32 #ifdef _WIN32
@ -66,7 +68,27 @@ const GLint c_MinLinearFilter[8] = {
GL_LINEAR GL_LINEAR
}; };
const GLint c_WrapSettings[4] = { GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT, GL_REPEAT }; const GLint c_WrapSettings[4] = {
GL_CLAMP_TO_EDGE,
GL_REPEAT,
GL_MIRRORED_REPEAT,
GL_REPEAT
};
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height)
{
GL_REPORT_ERRORD();
std::vector<u32> data(width * height);
glBindTexture(textarget, tex);
glGetTexImage(textarget, 0, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]);
GLenum err;
GL_REPORT_ERROR();
if (err != GL_NO_ERROR)
{
return false;
}
return SaveTGA(filename, width, height, &data[0]);
}
void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode) void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode)
{ {
@ -103,13 +125,13 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0 &newmode)
if (g_Config.iMaxAnisotropy >= 1) if (g_Config.iMaxAnisotropy >= 1)
{ {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1 << g_Config.iMaxAnisotropy); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)(1 << g_Config.iMaxAnisotropy));
} }
} }
void TextureMngr::TCacheEntry::Destroy() void TextureMngr::TCacheEntry::Destroy()
{ {
if(!texture) if (!texture)
return; return;
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
if (!isRenderTarget) { if (!isRenderTarget) {

View File

@ -20,14 +20,10 @@
#include <map> #include <map>
#include "VideoCommon.h"
#include "GLUtil.h" #include "GLUtil.h"
#include "BPStructs.h" #include "BPStructs.h"
struct TRectangle
{
int left, top, right, bottom;
};
class TextureMngr class TextureMngr
{ {
public: public:
@ -73,7 +69,6 @@ private:
static int nTex2DEnabled, nTexRECTEnabled; static int nTex2DEnabled, nTexRECTEnabled;
public: public:
static void Init(); static void Init();
static void Cleanup(); static void Cleanup();
static void Shutdown(); static void Shutdown();
@ -86,5 +81,6 @@ public:
static void DisableStage(int stage); // sets active texture static void DisableStage(int stage); // sets active texture
}; };
#endif bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height);
#endif