- dynamically allocate frameBuffer and DepthBuffer for glide64 and glide64mk2 (fix #728)
- make mk2 output to bizhawk output dir
- rebuild mk2 dll, but not glide64 just yet, since I experience artifacts that are probably a result of my compilation?
This commit is contained in:
feos 2016-11-16 22:48:59 +03:00
parent f539f011c5
commit 05f2c09aef
4 changed files with 28 additions and 17 deletions

View File

@ -212,10 +212,10 @@ static int texbuf_i;
static SDL_Surface *m_pScreen;
// unsigned short * frameBuffer = NULL;
// unsigned short * depthBuffer = NULL;
unsigned short frameBuffer[2048*2048];
unsigned short depthBuffer[2048*2048];
unsigned short *frameBuffer = NULL;
unsigned short *depthBuffer = NULL;
// unsigned short frameBuffer[2048*2048];
// unsigned short depthBuffer[2048*2048];
//#define VOODOO1
@ -550,6 +550,8 @@ grSstWinOpen(
// frameBuffer = (unsigned short *) calloc(2048, 2048*sizeof(unsigned short));
// depthBuffer = (unsigned short *) calloc(2048, 2048*sizeof(unsigned short));
frameBuffer = (unsigned short *)_aligned_malloc(height*width*4, 256);
depthBuffer = (unsigned short *)_aligned_malloc(height*width*2, 256);
screen_width = width;
screen_height = height;
@ -605,15 +607,15 @@ grSstWinClose( GrContext_t context )
invtex[i] = 0;
}
// if (frameBuffer)
// free(frameBuffer);
// if (depthBuffer)
// free(depthBuffer);
// frameBuffer = depthBuffer = NULL;
if (frameBuffer)
_aligned_free(frameBuffer);
if (depthBuffer)
_aligned_free(depthBuffer);
frameBuffer = depthBuffer = NULL;
free_combiners();
if (use_fbo)
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
free_combiners();
if (use_fbo)
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
if (clear_texbuff)
{

View File

@ -42,10 +42,10 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\..\..\output\dll\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\..\..\output\dll\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
@ -89,7 +89,7 @@
<AdditionalLibraryDirectories>..\lib;..\..\..\mupen64plus-win32-deps\boost-1.53.0\boost\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Debug/Glide64.pdb</ProgramDatabaseFile>
<ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
<ImportLibrary>.\Debug/Glide64.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>

View File

@ -199,8 +199,8 @@ struct texbuf_t {
static texbuf_t texbufs[NB_TEXBUFS];
static int texbuf_i;
unsigned short frameBuffer[2048*2048];
unsigned short depthBuffer[2048*2048];
unsigned short *frameBuffer = NULL;
unsigned short *depthBuffer = NULL;
//#define VOODOO1
@ -497,6 +497,9 @@ grSstWinOpen(
// ZIGGY viewport_offset is WIN32 specific, with SDL just set it to zero
viewport_offset = 0; //-10 //-20;
frameBuffer = (unsigned short *)_aligned_malloc(height*width*4, 256);
depthBuffer = (unsigned short *)_aligned_malloc(height*width*2, 256);
// ZIGGY not sure, but it might be better to let the system choose
CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, 1);
CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, vsync);
@ -743,6 +746,12 @@ grSstWinClose( GrContext_t context )
invtex[i] = 0;
}
if (frameBuffer)
_aligned_free(frameBuffer);
if (depthBuffer)
_aligned_free(depthBuffer);
frameBuffer = depthBuffer = NULL;
free_combiners();
#ifndef WIN32
try // I don't know why, but opengl can be killed before this function call when emulator is closed (Gonetz).