Use rsx::limits values

This commit is contained in:
Vincent Lejeune 2015-10-08 23:12:30 +02:00
parent 6f71d04aa4
commit d27f6c8fa7
8 changed files with 29 additions and 36 deletions

View file

@ -15,7 +15,7 @@ bool overlaps(const std::pair<size_t, size_t> &range1, const std::pair<size_t, s
std::vector<VertexBufferFormat> FormatVertexData(const RSXVertexData *m_vertex_data, size_t *vertex_data_size, size_t base_offset) std::vector<VertexBufferFormat> FormatVertexData(const RSXVertexData *m_vertex_data, size_t *vertex_data_size, size_t base_offset)
{ {
std::vector<VertexBufferFormat> Result; std::vector<VertexBufferFormat> Result;
for (size_t i = 0; i < 32; ++i) for (size_t i = 0; i < rsx::limits::vertex_count; ++i)
{ {
const RSXVertexData &vertexData = m_vertex_data[i]; const RSXVertexData &vertexData = m_vertex_data[i];
if (!vertexData.IsEnabled()) continue; if (!vertexData.IsEnabled()) continue;

View file

@ -394,7 +394,7 @@ void D3D12GSRender::Draw()
// Init vertex count // Init vertex count
if (m_indexed_array.m_count) if (m_indexed_array.m_count)
{ {
for (u32 i = 0; i < m_vertex_count; ++i) for (u32 i = 0; i < rsx::limits::vertex_count; ++i)
{ {
if (!m_vertex_data[i].IsEnabled()) continue; if (!m_vertex_data[i].IsEnabled()) continue;
if (!m_vertex_data[i].addr) continue; if (!m_vertex_data[i].addr) continue;
@ -405,7 +405,7 @@ void D3D12GSRender::Draw()
} }
else else
{ {
for (u32 i = 0; i < m_vertex_count; ++i) for (u32 i = 0; i < rsx::limits::vertex_count; ++i)
{ {
if (!m_vertex_data[i].IsEnabled()) continue; if (!m_vertex_data[i].IsEnabled()) continue;
if (!m_vertex_data[i].addr) continue; if (!m_vertex_data[i].addr) continue;

View file

@ -288,7 +288,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist)
{ {
size_t usedTexture = 0; size_t usedTexture = 0;
for (u32 i = 0; i < m_textures_count; ++i) for (u32 i = 0; i < rsx::limits::textures_count; ++i)
{ {
if (!m_textures[i].enabled()) continue; if (!m_textures[i].enabled()) continue;
size_t w = m_textures[i].width(), h = m_textures[i].height(); size_t w = m_textures[i].width(), h = m_textures[i].height();

View file

@ -804,12 +804,12 @@ extern CellGcmContextData current_context;
void GLGSRender::EnableVertexData(bool indexed_draw) void GLGSRender::EnableVertexData(bool indexed_draw)
{ {
static u32 offset_list[m_vertex_count]; static u32 offset_list[rsx::limits::vertex_count];
u32 cur_offset = 0; u32 cur_offset = 0;
const u32 data_offset = indexed_draw ? 0 : draw_array_first; const u32 data_offset = indexed_draw ? 0 : draw_array_first;
for (u32 i = 0; i < m_vertex_count; ++i) for (u32 i = 0; i < rsx::limits::vertex_count; ++i)
{ {
if (0) if (0)
{ {
@ -870,7 +870,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
rFile dump("VertexDataArray.dump", rFile::write); rFile dump("VertexDataArray.dump", rFile::write);
#endif #endif
for (u32 i = 0; i < m_vertex_count; ++i) for (u32 i = 0; i < rsx::limits::vertex_count; ++i)
{ {
if (!m_vertex_data[i].IsEnabled()) continue; if (!m_vertex_data[i].IsEnabled()) continue;
@ -1012,7 +1012,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
void GLGSRender::DisableVertexData() void GLGSRender::DisableVertexData()
{ {
m_vdata.clear(); m_vdata.clear();
for (u32 i = 0; i < m_vertex_count; ++i) for (u32 i = 0; i < rsx::limits::vertex_count; ++i)
{ {
if (!m_vertex_data[i].IsEnabled()) continue; if (!m_vertex_data[i].IsEnabled()) continue;
glDisableVertexAttribArray(i); glDisableVertexAttribArray(i);
@ -1910,7 +1910,7 @@ void GLGSRender::Draw()
LOG_WARNING(RSX, "m_indexed_array.m_count && draw_array_count"); LOG_WARNING(RSX, "m_indexed_array.m_count && draw_array_count");
} }
for (u32 i = 0; i < m_textures_count; ++i) for (u32 i = 0; i < rsx::limits::textures_count; ++i)
{ {
if (!m_textures[i].enabled()) continue; if (!m_textures[i].enabled()) continue;
@ -1924,11 +1924,11 @@ void GLGSRender::Draw()
checkForGlError(fmt::format("m_gl_textures[%d].Init", i)); checkForGlError(fmt::format("m_gl_textures[%d].Init", i));
} }
for (u32 i = 0; i < m_textures_count; ++i) for (u32 i = 0; i < rsx::limits::vertex_textures_count; ++i)
{ {
if (!m_vertex_textures[i].enabled()) continue; if (!m_vertex_textures[i].enabled()) continue;
glActiveTexture(GL_TEXTURE0 + m_textures_count + i); glActiveTexture(GL_TEXTURE0 + rsx::limits::textures_count + i);
checkForGlError("glActiveTexture"); checkForGlError("glActiveTexture");
m_gl_vertex_textures[i].Create(); m_gl_vertex_textures[i].Create();
m_gl_vertex_textures[i].Bind(); m_gl_vertex_textures[i].Bind();

View file

@ -125,8 +125,8 @@ private:
GLFragmentProgram m_fragment_prog; GLFragmentProgram m_fragment_prog;
GLVertexProgram m_vertex_prog; GLVertexProgram m_vertex_prog;
GLTexture m_gl_textures[m_textures_count]; GLTexture m_gl_textures[rsx::limits::textures_count];
GLTexture m_gl_vertex_textures[m_textures_count]; GLTexture m_gl_vertex_textures[rsx::limits::vertex_textures_count];
GLvao m_vao; GLvao m_vao;
GLvbo m_vbo; GLvbo m_vbo;

View file

@ -112,32 +112,25 @@ struct RSXTransformConstant
class RSXThread : protected named_thread_t class RSXThread : protected named_thread_t
{ {
public:
static const uint m_textures_count = 16;
static const uint m_vertex_count = 32;
static const uint m_fragment_count = 32;
static const uint m_tiles_count = 15;
static const uint m_zculls_count = 8;
protected: protected:
std::stack<u32> m_call_stack; std::stack<u32> m_call_stack;
CellGcmControl* m_ctrl; CellGcmControl* m_ctrl;
Timer m_timer_sync; Timer m_timer_sync;
public: public:
GcmTileInfo tiles[m_tiles_count]; GcmTileInfo tiles[rsx::limits::tiles_count];
GcmZcullInfo zculls[m_zculls_count]; GcmZcullInfo zculls[rsx::limits::zculls_count];
rsx::texture m_textures[m_textures_count]; rsx::texture m_textures[rsx::limits::textures_count];
rsx::vertex_texture m_vertex_textures[m_textures_count]; rsx::vertex_texture m_vertex_textures[rsx::limits::vertex_textures_count];
RSXVertexData m_vertex_data[m_vertex_count]; RSXVertexData m_vertex_data[rsx::limits::vertex_count];
RSXIndexArrayData m_indexed_array; RSXIndexArrayData m_indexed_array;
std::vector<RSXTransformConstant> m_fragment_constants; std::vector<RSXTransformConstant> m_fragment_constants;
std::vector<RSXTransformConstant> m_transform_constants; std::vector<RSXTransformConstant> m_transform_constants;
u32 m_shader_ctrl, m_cur_fragment_prog_num; u32 m_shader_ctrl, m_cur_fragment_prog_num;
RSXFragmentProgram m_fragment_progs[m_fragment_count]; RSXFragmentProgram m_fragment_progs[rsx::limits::fragment_count];
RSXFragmentProgram* m_cur_fragment_prog; RSXFragmentProgram* m_cur_fragment_prog;
RSXVertexProgram m_vertex_progs[m_vertex_count]; RSXVertexProgram m_vertex_progs[rsx::limits::vertex_count];
RSXVertexProgram* m_cur_vertex_prog; RSXVertexProgram* m_cur_vertex_prog;
public: public:
@ -650,7 +643,7 @@ protected:
m_clear_surface_mask = 0; m_clear_surface_mask = 0;
m_begin_end = 0; m_begin_end = 0;
for (uint i = 0; i < m_textures_count; ++i) for (uint i = 0; i < rsx::limits::textures_count; ++i)
{ {
m_textures[i].init(i); m_textures[i].init(i);
} }
@ -729,7 +722,7 @@ protected:
void LoadVertexData(u32 first, u32 count) void LoadVertexData(u32 first, u32 count)
{ {
for (u32 i = 0; i < m_vertex_count; ++i) for (u32 i = 0; i < rsx::limits::vertex_count; ++i)
{ {
if (!m_vertex_data[i].IsEnabled()) continue; if (!m_vertex_data[i].IsEnabled()) continue;

View file

@ -251,7 +251,7 @@ s32 cellGcmBindTile(u8 index)
{ {
cellGcmSys.Warning("cellGcmBindTile(index=%d)", index); cellGcmSys.Warning("cellGcmBindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count) if (index >= rsx::limits::tiles_count)
{ {
cellGcmSys.Error("cellGcmBindTile: CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmBindTile: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
@ -267,7 +267,7 @@ s32 cellGcmBindZcull(u8 index)
{ {
cellGcmSys.Warning("cellGcmBindZcull(index=%d)", index); cellGcmSys.Warning("cellGcmBindZcull(index=%d)", index);
if (index >= RSXThread::m_zculls_count) if (index >= rsx::limits::zculls_count)
{ {
cellGcmSys.Error("cellGcmBindZcull: CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmBindZcull: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
@ -551,7 +551,7 @@ s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u
cellGcmSys.Warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", cellGcmSys.Warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)",
index, location, offset, size, pitch, comp, base, bank); index, location, offset, size, pitch, comp, base, bank);
if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) if (index >= rsx::limits::tiles_count || base >= 800 || bank >= 4)
{ {
cellGcmSys.Error("cellGcmSetTileInfo: CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmSetTileInfo: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
@ -625,7 +625,7 @@ s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
cellGcmSys.Todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", cellGcmSys.Todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)",
index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask); index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask);
if (index >= RSXThread::m_zculls_count) if (index >= rsx::limits::zculls_count)
{ {
cellGcmSys.Error("cellGcmSetZcull: CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmSetZcull: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
@ -652,7 +652,7 @@ s32 cellGcmUnbindTile(u8 index)
{ {
cellGcmSys.Warning("cellGcmUnbindTile(index=%d)", index); cellGcmSys.Warning("cellGcmUnbindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count) if (index >= rsx::limits::tiles_count)
{ {
cellGcmSys.Error("cellGcmUnbindTile: CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmUnbindTile: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;
@ -1142,7 +1142,7 @@ s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
index, location, offset, size, pitch, comp, base, bank); index, location, offset, size, pitch, comp, base, bank);
// Copied form cellGcmSetTileInfo // Copied form cellGcmSetTileInfo
if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) if (index >= rsx::limits::tiles_count || base >= 800 || bank >= 4)
{ {
cellGcmSys.Error("cellGcmSetTile: CELL_GCM_ERROR_INVALID_VALUE"); cellGcmSys.Error("cellGcmSetTile: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE; return CELL_GCM_ERROR_INVALID_VALUE;

View file

@ -551,7 +551,7 @@ void RSXDebugger::GetTexture()
const GSRender& render = Emu.GetGSManager().GetRender(); const GSRender& render = Emu.GetGSManager().GetRender();
m_list_texture->DeleteAllItems(); m_list_texture->DeleteAllItems();
for(uint i=0; i<RSXThread::m_textures_count; ++i) for(uint i=0; i<rsx::limits::textures_count; ++i)
{ {
if(render.m_textures[i].enabled()) if(render.m_textures[i].enabled())
{ {