RSXVertexData bugs fixed

* Some extra info on sys_rsx syscalls
* Code cleaned in GLGSRender.cpp
This commit is contained in:
Alexandro Sánchez Bach 2014-08-18 16:37:23 +02:00
parent f71780609d
commit b23a5f2312
3 changed files with 96 additions and 72 deletions

View File

@ -188,21 +188,25 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
GL_HALF_FLOAT,
GL_UNSIGNED_BYTE,
GL_SHORT,
GL_FLOAT, // Needs conversion
GL_UNSIGNED_BYTE,
};
static const bool gl_normalized[] =
{
true,
false,
false,
true,
false,
false,
GL_TRUE,
GL_FALSE,
GL_FALSE,
GL_TRUE,
GL_FALSE,
GL_TRUE,
GL_FALSE,
};
if(m_vertex_data[i].type >= 1 && m_vertex_data[i].type <= 7)
{
if (m_vertex_data[i].type < 1 && m_vertex_data[i].type > 7) {
LOG_ERROR(RSX, "GLGSRender::EnableVertexData: Bad vertex data type (%d)!", m_vertex_data[i].type);
}
if(!m_vertex_data[i].addr)
{
switch(m_vertex_data[i].type)
@ -248,7 +252,6 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
}
}
}
}
void GLGSRender::DisableVertexData()
{
@ -264,15 +267,15 @@ void GLGSRender::DisableVertexData()
void GLGSRender::InitVertexData()
{
GLfloat scaleOffsetMat[16] = {1.0f, 0.0f, 0.0f, 0.0f,
int l;
GLfloat scaleOffsetMat[16] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f};
int l;
0.0f, 0.0f, 0.0f, 1.0f
};
for(u32 i=0; i<m_transform_constants.size(); ++i)
{
const RSXTransformConstant& c = m_transform_constants[i];
for (const RSXTransformConstant& c : m_transform_constants) {
const std::string name = fmt::Format("vc[%u]", c.id);
l = m_program.GetLocation(name);
checkForGlError("glGetUniformLocation " + name);
@ -308,10 +311,7 @@ void GLGSRender::InitFragmentData()
return;
}
for(u32 i=0; i<m_fragment_constants.size(); ++i)
{
const RSXTransformConstant& c = m_fragment_constants[i];
for(const RSXTransformConstant& c : m_fragment_constants) {
u32 id = c.id - m_cur_shader_prog->offset;
//LOG_WARNING(RSX,"fc%u[0x%x - 0x%x] = (%f, %f, %f, %f)", id, c.id, m_cur_shader_prog->offset, c.x, c.y, c.z, c.w);

View File

@ -117,17 +117,19 @@ u32 RSXVertexData::GetTypeSize()
{
switch (type)
{
case 1: return 2;
case 2: return 4;
case 3: return 2;
case 4: return 1;
case 5: return 2;
case 7: return 1;
}
case CELL_GCM_VERTEX_S1: return 2;
case CELL_GCM_VERTEX_F: return 4;
case CELL_GCM_VERTEX_SF: return 2;
case CELL_GCM_VERTEX_UB: return 1;
case CELL_GCM_VERTEX_S32K: return 2;
case CELL_GCM_VERTEX_CMP: return 4;
case CELL_GCM_VERTEX_UB256: return 1;
LOG_ERROR(RSX, "Bad vertex data type! %d", type);
default:
LOG_ERROR(RSX, "RSXVertexData::GetTypeSize: Bad vertex data type (%d)!", type);
return 1;
}
}
#define CMD_DEBUG 0

View File

@ -101,15 +101,27 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6
switch(package_id)
{
case 0x001: // ?
case 0x001: // FIFO
break;
case 0x101: // ?
case 0x100: // Display mode set
break;
case 0x101: // Display sync
break;
case 0x102: // Display flip
break;
case 0x103: // ?
break;
case 0x104: // Display buffer
break;
case 0x106: // ? (Used by cellGcmInitPerfMon)
break;
case 0x10a: // ?
break;
@ -119,9 +131,19 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6
case 0x301: // Depth-buffer (Z-cull)
break;
default:
case 0x600: // Framebuffer setup
break;
case 0x601: // Framebuffer blit
break;
case 0x602: // Framebuffer blit sync
break;
default:
return CELL_EINVAL;
}
return CELL_OK;
}
@ -129,7 +151,7 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6
* lv2 SysCall 675 (0x2A3): sys_rsx_device_map
* @param a1 (OUT): For example: In vsh.self it is 0x60000000, global semaphore. For a game it is 0x40000000.
* @param a2 (OUT): Unused?
* @param dev_id (IN): An immediate value and always 8.
* @param dev_id (IN): An immediate value and always 8. (cellGcmInitPerfMon uses 11, 10, 9, 7, 12 successively).
*/
s32 sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 dev_id)
{