diff --git a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp index ca0a9815ee..fe65871dd5 100644 --- a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp @@ -6,7 +6,7 @@ void GLFragmentDecompilerThread::AddCode(std::string code, bool append_mask) if(!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt) return; const std::string mask = GetMask().c_str(); - std::string cond = ""; + std::string cond; if(!src0.exec_if_gr || !src0.exec_if_lt || !src0.exec_if_eq) { @@ -70,26 +70,22 @@ void GLFragmentDecompilerThread::AddCode(std::string code, bool append_mask) code = "clamp(" + code + ", 0.0, 1.0)"; } - if(!dst.no_dest) - { - std::string dest; + std::string dest; + if(dst.no_dest) + { if(dst.set_cond) { dest = m_parr.AddParam(PARAM_NONE , "vec4", std::string(dst.fp16 ? "hc" : "rc") + std::to_string(src0.cond_reg_index)); } - else - { - dest = AddReg(dst.dest_reg, dst.fp16); - } - - code = cond + dest + mask + " = " + code + (append_mask ? mask : ""); } else { - code = cond + code + (append_mask ? mask : ""); + dest = AddReg(dst.dest_reg, dst.fp16); } + code = cond + (dest.length() ? dest + mask + " = " : "") + code + (append_mask ? mask : ""); + main += "\t" + code + ";\n"; } diff --git a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp index 6247ce75e4..8060882778 100644 --- a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp @@ -214,7 +214,7 @@ void GLVertexDecompilerThread::AddCode(bool is_sca, wxString code, bool src_mask { if(d3.vec_writemask_x) { - dest = "gl_FogFragCoord"; + dest = m_parr.AddParam(PARAM_OUT, "vec4", "fogc") + mask; } else { @@ -338,6 +338,8 @@ wxString GLVertexDecompilerThread::BuildCode() void GLVertexDecompilerThread::Task() { + m_parr.params.Clear(); + for(u32 i=0;;) { d0.HEX = m_data[i++]; diff --git a/rpcs3/Emu/Memory/Memory.h b/rpcs3/Emu/Memory/Memory.h index f8ebb5e112..053c0cf38d 100644 --- a/rpcs3/Emu/Memory/Memory.h +++ b/rpcs3/Emu/Memory/Memory.h @@ -691,12 +691,17 @@ struct _func_arg template struct _func_arg> { - __forceinline static u64 get_value(const mem_base_t& arg) + __forceinline static u64 get_value(const mem_base_t arg) { return arg.GetAddr(); } }; +template struct _func_arg> : public _func_arg> {}; +template<> struct _func_arg> : public _func_arg> {}; +template struct _func_arg> : public _func_arg> {}; +template struct _func_arg> : public _func_arg> {}; + template struct _func_arg> {