1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

Merge pull request #295 from raven02/patch-32

Fragment decompiler changes to async mode
This commit is contained in:
B1ackDaemon 2014-06-01 16:16:08 +03:00
commit fea95d264f
4 changed files with 26 additions and 20 deletions

View File

@ -155,7 +155,7 @@ public:
/**
* Asynchronously decompile a fragment shader located in the PS3's Memory.
* When this function is called you must call Wait before GetShaderText() will return valid data.
* When this function is called you must call Wait() before GetShaderText() will return valid data.
* @param prog RSXShaderProgram specifying the location and size of the shader in memory
*/
void DecompileAsync(RSXShaderProgram& prog);

View File

@ -396,7 +396,8 @@ bool GLGSRender::LoadProgram()
if(m_fp_buf_num == -1)
{
ConLog.Warning("FP not found in buffer!");
m_shader_prog.Decompile(*m_cur_shader_prog);
m_shader_prog.DecompileAsync(*m_cur_shader_prog);
m_shader_prog.Wait();
m_shader_prog.Compile();
checkForGlError("m_shader_prog.Compile");
@ -407,7 +408,7 @@ bool GLGSRender::LoadProgram()
if(m_vp_buf_num == -1)
{
ConLog.Warning("VP not found in buffer!");
m_vertex_prog.Decompile(*m_cur_vertex_prog);
m_vertex_prog.DecompileAsync(*m_cur_vertex_prog);
m_vertex_prog.Wait();
m_vertex_prog.Compile();
checkForGlError("m_vertex_prog.Compile");

View File

@ -466,15 +466,25 @@ GLVertexProgram::~GLVertexProgram()
Delete();
}
void GLVertexProgram::Wait()
{
if(m_decompiler_thread && m_decompiler_thread->IsAlive())
{
m_decompiler_thread->Join();
}
}
void GLVertexProgram::Decompile(RSXVertexProgram& prog)
{
#if 0
GLVertexDecompilerThread(data, shader, parr).Entry();
#else
if(m_decompiler_thread)
GLVertexDecompilerThread(prog.data, shader, parr);
}
void GLVertexProgram::DecompileAsync(RSXVertexProgram& prog)
{
if (m_decompiler_thread)
{
Wait();
if(m_decompiler_thread->IsAlive())
if (m_decompiler_thread->IsAlive())
{
m_decompiler_thread->Stop();
}
@ -485,7 +495,6 @@ void GLVertexProgram::Decompile(RSXVertexProgram& prog)
m_decompiler_thread = new GLVertexDecompilerThread(prog.data, shader, parr);
m_decompiler_thread->Start();
#endif
}
void GLVertexProgram::Compile()

View File

@ -172,10 +172,9 @@ struct GLVertexDecompilerThread : public ThreadBase
virtual void Task();
};
struct GLVertexProgram
class GLVertexProgram
{
GLVertexDecompilerThread* m_decompiler_thread;
public:
GLVertexProgram();
~GLVertexProgram();
@ -183,15 +182,12 @@ struct GLVertexProgram
u32 id;
std::string shader;
void Wait()
{
if(m_decompiler_thread && m_decompiler_thread->IsAlive())
{
m_decompiler_thread->Join();
}
}
void Decompile(RSXVertexProgram& prog);
void DecompileAsync(RSXVertexProgram& prog);
void Wait();
void Compile();
private:
GLVertexDecompilerThread* m_decompiler_thread;
void Delete();
};