Merge pull request #58 from elisha464/master

Fixed some vector instructions and a small fix in the fragment shader decompiler
This commit is contained in:
Alexandro Sánchez Bach 2014-01-28 11:41:27 -08:00
commit d07b5f0dc8
4 changed files with 34 additions and 16 deletions

View File

@ -1209,11 +1209,15 @@ private:
}
void VPERM(u32 vd, u32 va, u32 vb, u32 vc)
{
u8 tmpSRC[32];
memcpy(tmpSRC, CPU.VPR[vb]._u8, 16);
memcpy(tmpSRC + 16, CPU.VPR[va]._u8, 16);
for (uint b = 0; b < 16; b++)
{
u8 index = CPU.VPR[vc]._u8[b] & 0x1f;
CPU.VPR[vd]._u8[b] = index < 0x10 ? CPU.VPR[va]._u8[0xf - index] : CPU.VPR[vb]._u8[0xf - (index - 0x10)];
CPU.VPR[vd]._u8[b] = tmpSRC[0x1f - index];
}
}
void VPKPX(u32 vd, u32 va, u32 vb)
@ -1552,14 +1556,23 @@ private:
}
void VSLDOI(u32 vd, u32 va, u32 vb, u32 sh)
{
for (uint b = 0; b < 16 - sh; b++)
u8 tmpSRC[32];
memcpy(tmpSRC, CPU.VPR[vb]._u8, 16);
memcpy(tmpSRC + 16, CPU.VPR[va]._u8, 16);
for(uint b=0; b<16; b++)
{
CPU.VPR[vd]._u8[15 - b] = tmpSRC[31 - (b + sh)];
}
/*for (uint b = 0; b < 16 - sh; b++)
{
CPU.VPR[vd]._u8[15 - b] = CPU.VPR[va]._u8[15 - (b + sh)];
}
for (uint b = 16 - sh; b < 16; b++)
{
CPU.VPR[vd]._u8[15 - b] = CPU.VPR[vb]._u8[15 - (b - (16 - sh))];
}
}*/
}
void VSLH(u32 vd, u32 va, u32 vb)
{

View File

@ -98,17 +98,16 @@ std::string GLFragmentDecompilerThread::GetMask()
std::string GLFragmentDecompilerThread::AddReg(u32 index, int fp16)
{
/*
if(HasReg(index, fp16))
{
return wxString::Format((fp16 ? "h%u" : "r%u"), index);
}
*/
if(index >= 2 && index <= 4)
{
return m_parr.AddParam(PARAM_OUT, "vec4", std::string(fp16 ? "h" : "r") + std::to_string(index),
(fp16) ? -1 : (index - 1));
}
//ConLog.Warning("%c%d: %d %d", (fp16 ? 'h' : 'r'), index, dst.tex_num, src2.use_index_reg);
return m_parr.AddParam(PARAM_NONE, "vec4", std::string(fp16 ? "h" : "r") + std::to_string(index), "vec4(0.0)");
return m_parr.AddParam((index >= 2 && index <= 4) ? PARAM_OUT : PARAM_NONE, "vec4",
std::string(fp16 ? "h" : "r") + std::to_string(index), (fp16 || !index) ? -1 : ((index >= 2 && index <= 4) ? (index - 1) : -1));
//return m_parr.AddParam((index >= 2 && index <= 4) ? PARAM_OUT : PARAM_NONE, "vec4",
// std::string(fp16 ? "h" : "r") + std::to_string(index), (fp16 || !index) ? -1 : ((index >= 2 && index <= 4) ? (index - 1) : -1));
}
bool GLFragmentDecompilerThread::HasReg(u32 index, int fp16)
@ -219,6 +218,15 @@ std::string GLFragmentDecompilerThread::BuildCode()
p += m_parr.params[i].Format();
}
//return "#version 330\n\
\n\
out vec3 color;\n\
in vec4 tc1;\n\
\n\
void main()\n\
{\n\
color = tc1.rgb;\n\
}";
return std::string("#version 330\n"
"\n"
+ p + "\n"

View File

@ -265,7 +265,6 @@ public:
u32 m_report_main_addr;
u32 m_local_mem_addr, m_main_mem_addr;
Array<MemInfo> m_main_mem_info;
public:
uint m_draw_mode;
@ -637,7 +636,7 @@ protected:
switch(location)
{
case CELL_GCM_LOCATION_LOCAL: return m_local_mem_addr + offset;
case CELL_GCM_LOCATION_MAIN: return m_main_mem_addr + offset;
case CELL_GCM_LOCATION_MAIN: return Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + offset);
}
ConLog.Error("GetAddress(offset=0x%x, location=0x%x)", location);

View File

@ -107,7 +107,6 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress)
render.m_tiles_addr = Memory.Alloc(sizeof(CellGcmTileInfo) * 15, sizeof(CellGcmTileInfo));
render.m_gcm_buffers_count = 0;
render.m_gcm_current_buffer = 0;
render.m_main_mem_info.Clear();
render.m_main_mem_addr = 0;
render.Init(ctx_begin, ctx_size, gcm_info.control_addr, local_addr);
@ -725,7 +724,6 @@ int32_t cellGcmMapMainMemory(u64 ea, u32 size, mem32_t offset)
}
Emu.GetGSManager().GetRender().m_main_mem_addr = Emu.GetGSManager().GetRender().m_ioAddress;
Emu.GetGSManager().GetRender().m_main_mem_info.AddCpy(MemInfo(ea, size));
return CELL_OK;
}