diff --git a/core/hw/pvr/ta_ctx.h b/core/hw/pvr/ta_ctx.h index 59e8eda6d..2d7beec96 100644 --- a/core/hw/pvr/ta_ctx.h +++ b/core/hw/pvr/ta_ctx.h @@ -55,12 +55,13 @@ struct tad_context u8* thd_data; u8* thd_root; u8* thd_old_data; - vector render_passes; + u8 *render_passes[10]; + u32 render_pass_count; void Clear() { thd_old_data = thd_data = thd_root; - render_passes.clear(); + render_pass_count = 0; } void ClearPartial() @@ -71,7 +72,7 @@ struct tad_context void Continue() { - render_passes.push_back(thd_data); + render_passes[render_pass_count++] = thd_data; } u8* End() @@ -82,7 +83,7 @@ struct tad_context void Reset(u8* ptr) { thd_data = thd_root = thd_old_data = ptr; - render_passes.clear(); + render_pass_count = 0; } }; @@ -169,10 +170,10 @@ struct TA_context void MarkRend(u32 render_pass) { - verify(render_pass <= tad.render_passes.size()); + verify(render_pass <= tad.render_pass_count); rend.proc_start = render_pass == 0 ? tad.thd_root : tad.render_passes[render_pass - 1]; - rend.proc_end = render_pass == tad.render_passes.size() ? tad.End() : tad.render_passes[render_pass]; + rend.proc_end = render_pass == tad.render_pass_count ? tad.End() : tad.render_passes[render_pass]; } void Alloc() diff --git a/core/hw/pvr/ta_vtx.cpp b/core/hw/pvr/ta_vtx.cpp index 68cf09226..7ebb65fa3 100644 --- a/core/hw/pvr/ta_vtx.cpp +++ b/core/hw/pvr/ta_vtx.cpp @@ -1448,7 +1448,7 @@ bool ta_parse_vdrc(TA_context* ctx) { TAFifo0.vdec_init(); - for (int pass = 0; pass <= ctx->tad.render_passes.size(); pass++) + for (int pass = 0; pass <= ctx->tad.render_pass_count; pass++) { ctx->MarkRend(pass); vd_rc.proc_start = ctx->rend.proc_start; diff --git a/core/linux/context.cpp b/core/linux/context.cpp index d420c6885..cf0601328 100644 --- a/core/linux/context.cpp +++ b/core/linux/context.cpp @@ -61,7 +61,11 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se #error HOST_OS #endif #elif HOST_CPU == CPU_X64 - bicopy(reictx->pc, MCTX(.gregs[REG_RIP]), to_segfault); + #if HOST_OS == OS_LINUX + bicopy(reictx->pc, MCTX(.gregs[REG_RIP]), to_segfault); + #elif HOST_OS == OS_DARWIN + bicopy(reictx->pc, MCTX(->__ss.__rip), to_segfault); + #endif #elif HOST_CPU == CPU_MIPS bicopy(reictx->pc, MCTX(.pc), to_segfault); #elif HOST_CPU == CPU_GENERIC diff --git a/core/rec-ARM/ngen_arm.S b/core/rec-ARM/ngen_arm.S index 54ed724ce..83cf7b29a 100644 --- a/core/rec-ARM/ngen_arm.S +++ b/core/rec-ARM/ngen_arm.S @@ -177,7 +177,7 @@ CSYM(no_update): @ next_pc _MUST_ be on r4 *R4 NOT R0 anymore* @ below is inefficient. If anyone is familiar @ with asm please consider optimising! - ldr r3, =ngen_required @ load r3 with the address of c variable ngen_required + ldr r3, =CSYM(ngen_required) @ load r3 with the address of c variable ngen_required ldr r0,[r3] @ dereference and store in r0 cmp r0,#0 @ compare r0 with numerical value 0 beq CSYM(cleanup) @ if compare is true jump to cleanup label and exit thread diff --git a/core/rend/gles/gldraw.cpp b/core/rend/gles/gldraw.cpp index 5fc4c925b..1f84c77d3 100644 --- a/core/rend/gles/gldraw.cpp +++ b/core/rend/gles/gldraw.cpp @@ -980,7 +980,7 @@ void SetupModvolVBO() } void DrawModVols(int first, int count) { - if (count == 0 /*|| GetAsyncKeyState(VK_F4)*/) + if (count == 0 /*|| GetAsyncKeyState(VK_F4)*/) return; SetupModvolVBO(); @@ -1133,8 +1133,8 @@ void DrawStrips() glActiveTexture(GL_TEXTURE0); RenderPass previous_pass = {0}; - for (int render_pass = 0; render_pass < pvrrc.render_passes.used(); render_pass++) { - const RenderPass& current_pass = pvrrc.render_passes.head()[render_pass]; + for (int render_pass = 0; render_pass < pvrrc.render_passes.used(); render_pass++) { + const RenderPass& current_pass = pvrrc.render_passes.head()[render_pass]; //initial state glDisable(GL_BLEND); diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index efd51f746..f90b9fe09 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -896,7 +896,8 @@ bool gl_create_resources() glGenBuffers(1, &gl.vbo.modvols); glGenBuffers(1, &gl.vbo.idxs); glGenBuffers(1, &gl.vbo.idxs2); - + glCheck(); + memset(gl.pogram_table,0,sizeof(gl.pogram_table)); PipelineShader* dshader=0; @@ -1008,12 +1009,12 @@ bool gles_init() #endif //clean up all buffers ... - for (int i=0;i<10;i++) - { - glClearColor(0.f, 0.f, 0.f, 0.f); - glClear(GL_COLOR_BUFFER_BIT); - gl_swap(); - } +// for (int i=0;i<10;i++) +// { +// glClearColor(0.f, 0.f, 0.f, 0.f); glCheck(); +// glClear(GL_COLOR_BUFFER_BIT); glCheck(); +// gl_swap(); glCheck(); +// } return true; } @@ -1692,7 +1693,7 @@ bool RenderFrame() tryfit(xvals,yvals); } - glUseProgram(gl.modvol_shader.program); + glUseProgram(gl.modvol_shader.program); glCheck(); glUniform4fv( gl.modvol_shader.scale, 1, ShaderUniforms.scale_coefs); glUniform4fv( gl.modvol_shader.depth_scale, 1, ShaderUniforms.depth_coefs); @@ -1700,7 +1701,7 @@ bool RenderFrame() GLfloat td[4]={0.5,0,0,0}; - glUseProgram(gl.OSD_SHADER.program); + glUseProgram(gl.OSD_SHADER.program); glCheck(); glUniform4fv( gl.OSD_SHADER.scale, 1, ShaderUniforms.scale_coefs); glUniform4fv( gl.OSD_SHADER.depth_scale, 1, td); @@ -1760,9 +1761,10 @@ bool RenderFrame() { #if HOST_OS != OS_DARWIN //Fix this in a proper way - glBindFramebuffer(GL_FRAMEBUFFER,0); + glBindFramebuffer(GL_FRAMEBUFFER,0); glCheck(); #endif - glViewport(0, 0, screen_width, screen_height); + glViewport(0, 0, screen_width, screen_height); glCheck(); + } bool wide_screen_on = !is_rtt && settings.rend.WideScreen @@ -1776,8 +1778,9 @@ bool RenderFrame() glClearColor(pvrrc.verts.head()->col[2]/255.0f,pvrrc.verts.head()->col[1]/255.0f,pvrrc.verts.head()->col[0]/255.0f,1.0f); else glClearColor(0,0,0,1.0f); + glCheck(); - glDisable(GL_SCISSOR_TEST); + glDisable(GL_SCISSOR_TEST); glCheck(); glClear(GL_COLOR_BUFFER_BIT); glCheck(); //move vertex to gpu diff --git a/core/rend/gles/gles.h b/core/rend/gles/gles.h index 36688a5bb..6cd57596e 100755 --- a/core/rend/gles/gles.h +++ b/core/rend/gles/gles.h @@ -32,7 +32,7 @@ #endif -#define glCheck() do { if (unlikely(settings.validate.OpenGlChecks)) { verify(glGetError()==GL_NO_ERROR); } } while(0) +#define glCheck() do { /*if (unlikely(settings.validate.OpenGlChecks))*/ { GLenum err = glGetError(); if (err != GL_NO_ERROR) {printf("OpenGL error %d\n", err); die("OpenGL error"); }} } while(0) #define eglCheck() false #define VERTEX_POS_ARRAY 0 diff --git a/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift b/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift index c2022cfee..d5acf9c1e 100644 --- a/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift +++ b/shell/apple/emulator-osx/emulator-osx/EmuGLView.swift @@ -41,6 +41,7 @@ class EmuGLView: NSOpenGLView { [ UInt32(NSOpenGLPFADoubleBuffer), UInt32(NSOpenGLPFADepthSize), UInt32(24), + UInt32(NSOpenGLPFAStencilSize), UInt32(8), // Must specify the 3.2 Core Profile to use OpenGL 3.2 UInt32(NSOpenGLPFAOpenGLProfile), UInt32(NSOpenGLProfileVersion3_2Core), diff --git a/shell/apple/emulator-osx/emulator-osx/osx-main.mm b/shell/apple/emulator-osx/emulator-osx/osx-main.mm index 21e14f345..f95bdd38e 100644 --- a/shell/apple/emulator-osx/emulator-osx/osx-main.mm +++ b/shell/apple/emulator-osx/emulator-osx/osx-main.mm @@ -88,6 +88,7 @@ void gl_swap() { } +void common_linux_setup(); int dc_init(int argc,wchar* argv[]); void dc_run(); @@ -107,6 +108,7 @@ void* emuthread(void*) { set_user_config_dir("."); set_user_data_dir("."); } + common_linux_setup(); char* argv[] = { "reicast" }; dc_init(1,argv); @@ -132,6 +134,9 @@ extern "C" int emu_single_frame(int w, int h) { return true; screen_width = w; screen_height = h; + glViewport(0, 0, screen_width, screen_height); + GLenum err = glGetError(); + if (err != GL_NO_ERROR) {printf("OpenGL error %d\n", err); die("OpenGL error"); } return rend_single_frame(); } diff --git a/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj b/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj index 8e558c1e7..fe8162a83 100644 --- a/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj +++ b/shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj @@ -1659,7 +1659,6 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_NO_EXCEPTIONS, TARGET_NO_WEBUI, TARGET_NO_NIXPROF, TARGET_NO_COREIO_HTTP, @@ -1705,7 +1704,6 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_NO_EXCEPTIONS, TARGET_NO_WEBUI, TARGET_NO_NIXPROF, TARGET_NO_COREIO_HTTP,