Some osx build fix for OGL plugin. Not working ...

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@143 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
tmator 2008-08-06 21:07:31 +00:00
parent 84b3522c24
commit 89cb286812
9 changed files with 67 additions and 41 deletions

View File

@ -32,7 +32,7 @@ if sys.platform == 'darwin':
"Source/Core/DiscIO/Src",
"Source/Core/DebuggerWX/src",
"Source/Core/VideoCommon/Src",
# "Source/Plugins/Plugin_VideoOGL/Src",
"Source/Plugins/Plugin_VideoOGL/Src",
"Source/Plugins/Plugin_DSP_NULL/Src",
# "Source/Plugins/Plugin_DSP_LLE/Src",
"Source/Plugins/Plugin_PadSimple/Src",

View File

@ -93,12 +93,20 @@ void ConfigDialog::CreateGUIControls()
wxStaticText *FSText = new wxStaticText(m_PageVideo, ID_FSTEXT, wxT("Fullscreen video mode:"), wxDefaultPosition, wxDefaultSize, 0);
wxArrayString arrayStringFor_FullscreenCB;
m_FullscreenCB = new wxComboBox(m_PageVideo, ID_FULLSCREENCB, wxEmptyString, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, 0, wxDefaultValidator);
#ifdef MACOSX
m_FullscreenCB->SetValue(wxString::FromAscii(g_Config.iFSResolution));
#else
m_FullscreenCB->SetValue(g_Config.iFSResolution);
#endif
wxStaticText *WMText = new wxStaticText(m_PageVideo, ID_WMTEXT, wxT("Windowed resolution:"), wxDefaultPosition, wxDefaultSize, 0);
wxArrayString arrayStringFor_WindowResolutionCB;
m_WindowResolutionCB = new wxComboBox(m_PageVideo, ID_WINDOWRESOLUTIONCB, wxEmptyString, wxDefaultPosition, wxDefaultSize, arrayStringFor_WindowResolutionCB, 0, wxDefaultValidator);
#ifdef MACOSX
m_WindowResolutionCB->SetValue(wxString::FromAscii(g_Config.iWindowedRes));
#else
m_WindowResolutionCB->SetValue(g_Config.iWindowedRes);
#endif
//page2
m_ForceFiltering = new wxCheckBox(m_PageEnhancements, ID_FORCEFILTERING, wxT("Force bi/trilinear filtering (May cause small glitches)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);

View File

@ -52,7 +52,16 @@ void CloseConsole();
#define I_NEED_OS2_H // HAXXOR
//#include <GL/glew.h>
#include <GL/glxew.h>
#ifdef MACOSX
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
//#include <GL/glx.h>
#define __inline inline
@ -345,4 +354,4 @@ public:
#endif
#endif
#endif

View File

@ -67,11 +67,11 @@ void PixelShaderMngr::Init()
maptocoord_mask = 0;
memset(lastRGBAfull, 0, sizeof(lastRGBAfull));
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, &s_nMaxPixelInstructions);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, (GLint *)&s_nMaxPixelInstructions);
int maxinst, maxattribs;
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &maxinst);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, &maxattribs);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&maxinst);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, (GLint *)&maxattribs);
ERROR_LOG("pixel max_alu=%d, max_inst=%d, max_attrib=%d\n", s_nMaxPixelInstructions, maxinst, maxattribs);
char pmatrixprog[1024];

View File

@ -28,7 +28,6 @@
#include "PixelShaderManager.h"
#include "VertexLoader.h"
#ifdef _WIN32
#include "OS\Win32.h"
#else
@ -101,7 +100,7 @@ bool Renderer::Create2()
}
int numvertexattribs=0;
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs);
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)&numvertexattribs);
if (numvertexattribs < 11) {
ERROR_LOG("*********\nGPU: OGL ERROR: Number of attributes %d not enough\nGPU: *********\n", numvertexattribs);
@ -118,13 +117,13 @@ bool Renderer::Create2()
ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n");
#else
if (glXSwapIntervalSGI)
glXSwapIntervalSGI(0);
glXSwapIntervalSGI(0);
else
ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n");
#endif
// check the max texture width and height
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_MaxTexWidth);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&g_MaxTexWidth);
g_MaxTexHeight = g_MaxTexWidth;
GL_REPORT_ERROR();
@ -133,7 +132,7 @@ bool Renderer::Create2()
if (glDrawBuffers == NULL && !GLEW_ARB_draw_buffers)
glDrawBuffers = glDrawBuffersARB;
glGenFramebuffersEXT( 1, &s_uFramebuffer);
glGenFramebuffersEXT( 1, (GLuint *)&s_uFramebuffer);
if (s_uFramebuffer == 0) {
ERROR_LOG("failed to create the renderbuffer\n");
}
@ -142,7 +141,7 @@ bool Renderer::Create2()
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, s_uFramebuffer );
// create the framebuffer targets
glGenTextures(ARRAYSIZE(s_RenderTargets), s_RenderTargets);
glGenTextures(ARRAYSIZE((GLuint *)s_RenderTargets), (GLuint *)s_RenderTargets);
for(int i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) {
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[i]);
// initialize to default
@ -162,11 +161,11 @@ bool Renderer::Create2()
GL_REPORT_ERROR();
int nMaxMRT = 0;
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &nMaxMRT);
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, (GLint *)&nMaxMRT);
if( nMaxMRT > 1 ) {
// create zbuffer target
glGenTextures(1, &s_ZBufferTarget);
glGenTextures(1, (GLuint *)&s_ZBufferTarget);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, s_nTargetWidth, s_nTargetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
@ -182,7 +181,7 @@ bool Renderer::Create2()
}
// create the depth buffer
glGenRenderbuffersEXT( 1, &s_DepthTarget);
glGenRenderbuffersEXT( 1, (GLuint *)&s_DepthTarget);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_DepthTarget);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, s_nTargetWidth, s_nTargetHeight);
if( glGetError() != GL_NO_ERROR ) {
@ -205,7 +204,7 @@ bool Renderer::Create2()
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, 0, 0);
if( bFailed ) {
glDeleteTextures(1, &s_ZBufferTarget);
glDeleteTextures(1, (GLuint *)&s_ZBufferTarget);
s_ZBufferTarget = 0;
}
}
@ -243,10 +242,10 @@ bool Renderer::Create2()
//ERROR_LOG("max buffer sizes: %d %d\n", cgGetProgramBufferMaxSize(g_cgvProf), cgGetProgramBufferMaxSize(g_cgfProf));
int nenvvertparams, nenvfragparams, naddrregisters[2];
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &nenvvertparams);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &nenvfragparams);
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, &naddrregisters[0]);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, &naddrregisters[1]);
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvvertparams);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvfragparams);
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[0]);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[1]);
__Log("max program env parameters: vert=%d, frag=%d\n", nenvvertparams, nenvfragparams);
__Log("max program address register parameters: vert=%d, frag=%d\n", naddrregisters[0], naddrregisters[1]);
@ -282,15 +281,15 @@ void Renderer::Shutdown(void)
}
if( s_RenderTargets[0] ) {
glDeleteTextures(ARRAYSIZE(s_RenderTargets), s_RenderTargets);
glDeleteTextures(ARRAYSIZE((GLuint *)s_RenderTargets), (GLuint *)s_RenderTargets);
memset(s_RenderTargets, 0, sizeof(s_RenderTargets));
}
if( s_DepthTarget ) {
glDeleteRenderbuffersEXT(1, &s_DepthTarget); s_DepthTarget = 0;
glDeleteRenderbuffersEXT(1, (GLuint *)&s_DepthTarget); s_DepthTarget = 0;
}
if (s_uFramebuffer != 0) {
glDeleteFramebuffersEXT( 1, &s_uFramebuffer);
glDeleteFramebuffersEXT( 1, (GLuint *)&s_uFramebuffer);
s_uFramebuffer = 0;
}
}
@ -786,8 +785,8 @@ void HandleGLError()
int w, h;
GLint fmt;
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_INTERNAL_FORMAT_EXT, &fmt);
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_WIDTH_EXT, &w);
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_HEIGHT_EXT, &h);
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_WIDTH_EXT, (GLint *)&w);
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_HEIGHT_EXT, (GLint *)&h);
switch(error)
{

View File

@ -1,4 +1,5 @@
Import('env')
import sys
files = ["BPStructs.cpp",
"DataReader.cpp",
@ -23,7 +24,9 @@ files = ["BPStructs.cpp",
# "Linux/Linux.cpp",
"GUI/ConfigDlg.cpp",
]
gfxenv=env.Copy(CXXFLAGS = " `wx-config --cppflags` `pkg-config --cflags xxf86vm` ", LINKFLAGS = "`wx-config --libs` `pkg-config --libs xxf86vm` ")
gfxenv.SharedLibrary("../../../../Binary/linux/Plugins/zeroogl.so", files, LIBS=["videocommon", "common", "cairo", "GL", "GLU", "GLEW", "CgGL", "Cg", "X11"])
if sys.platform == 'darwin':
gfxenv=env.Copy(CXXFLAGS = " -DMACOSX=1 `wx-config --cppflags` ", LINKFLAGS = " -framework OpenGL -framework Cg `wx-config --libs` ")
gfxenv.SharedLibrary("../../../../Binary/mac/Plugins/zeroogl.so", files, LIBS=["videocommon", "common", "cairo", "GLEW"])
else:
gfxenv=env.Copy(CXXFLAGS = " `wx-config --cppflags` `pkg-config --cflags xxf86vm` ", LINKFLAGS = "`wx-config --libs` `pkg-config --libs xxf86vm` ")
gfxenv.SharedLibrary("../../../../Binary/linux/Plugins/zeroogl.so", files, LIBS=["videocommon", "common", "cairo", "GL", "GLU", "GLEW", "CgGL", "Cg", "X11"])

View File

@ -80,14 +80,13 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0& newmode)
void TextureMngr::TCacheEntry::Destroy()
{
SAFE_RELEASE_TEX(texture);
SAFE_RELEASE_TEX((GLuint)texture);
}
void TextureMngr::Init()
{
temp = (u8*)AllocateMemoryPages(TEMP_SIZE);
nTex2DEnabled = nTexRECTEnabled = 0;
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable,g_Config.bTexFmtOverlayCenter);
}
void TextureMngr::Invalidate()
@ -96,7 +95,6 @@ void TextureMngr::Invalidate()
for (;iter!=textures.end();iter++)
iter->second.Destroy();
textures.clear();
TexDecoder_SetTexFmtOverlayOptions(g_Config.bTexFmtOverlayEnable,g_Config.bTexFmtOverlayCenter);
}
void TextureMngr::Shutdown()
@ -109,7 +107,7 @@ void TextureMngr::Shutdown()
mapDepthTargets.clear();
if( s_TempFramebuffer ) {
glDeleteFramebuffersEXT(1, &s_TempFramebuffer);
glDeleteFramebuffersEXT(1, (GLuint *)&s_TempFramebuffer);
s_TempFramebuffer = 0;
}
@ -242,7 +240,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
entry.isNonPow2 = ((width&(width-1)) || (height&(height-1)));
glGenTextures(1, &entry.texture);
glGenTextures(1, (GLuint *)&entry.texture);
GLenum target = entry.isNonPow2 ? GL_TEXTURE_RECTANGLE_NV : GL_TEXTURE_2D;
glBindTexture(target, entry.texture);
@ -278,7 +276,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
if (g_Config.bDumpTextures) { // dump texture to file
static int counter = 0;
char szTemp[MAX_PATH];
sprintf(szTemp, "%s/txt_%04i_%i.tga", g_Config.texDumpPath, counter++, format);
sprintf(szTemp, "%s/txt_%04i_%i.tga", g_Config.texDumpPath, counter++, format);
SaveTexture(szTemp,target, entry.texture, width, height);
}
@ -323,7 +321,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
GL_REPORT_ERRORD();
if( !bIsInit ) {
glGenTextures(1, &entry.texture);
glGenTextures(1, (GLuint *)&entry.texture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
GL_REPORT_ERRORD();
@ -343,8 +341,8 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
if( bReInit ) {
// necessary, for some reason opengl gives errors when texture isn't deleted
glDeleteTextures(1,&entry.texture);
glGenTextures(1, &entry.texture);
glDeleteTextures(1,(GLuint *)&entry.texture);
glGenTextures(1, (GLuint *)&entry.texture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
GL_REPORT_ERRORD();
@ -489,7 +487,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
Renderer::ResetGLState(); // reset any game specific settings
if( s_TempFramebuffer == 0 )
glGenFramebuffersEXT( 1, &s_TempFramebuffer);
glGenFramebuffersEXT( 1, (GLuint *)&s_TempFramebuffer);
Renderer::SetFramebuffer(s_TempFramebuffer);
Renderer::SetRenderTarget(entry.texture);
@ -587,4 +585,4 @@ void TextureMngr::DisableStage(int stage)
if( !bset ) glActiveTexture(GL_TEXTURE0+stage);
glDisable(GL_TEXTURE_RECTANGLE_NV);
}
}
}

View File

@ -68,7 +68,7 @@ void VertexShaderMngr::Init()
memset(&xfregs, 0, sizeof(xfregs));
memset(xfmem, 0, sizeof(xfmem));
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &s_nMaxVertexInstructions);
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&s_nMaxVertexInstructions);
}
void VertexShaderMngr::Shutdown()

View File

@ -21,7 +21,16 @@
#include <windows.h>
#endif
#ifdef MACOSX
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include <string.h>
#include "rasterfont.h"