diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index 87426ff849..18d5c9e176 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -15,7 +15,7 @@ bool overlaps(const std::pair &range1, const std::pair FormatVertexData(const RSXVertexData *m_vertex_data, size_t *vertex_data_size, size_t base_offset) { std::vector 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]; if (!vertexData.IsEnabled()) continue; diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 1dbbfbcc70..4dfea2684f 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -394,7 +394,7 @@ void D3D12GSRender::Draw() // Init vertex 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].addr) continue; @@ -405,7 +405,7 @@ void D3D12GSRender::Draw() } 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].addr) continue; diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp index e86bb5219a..d095dfece0 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp @@ -288,7 +288,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist) { 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; size_t w = m_textures[i].width(), h = m_textures[i].height(); diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 7d68dabd9f..c6c1bcb081 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -804,12 +804,12 @@ extern CellGcmContextData current_context; 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; 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) { @@ -870,7 +870,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw) rFile dump("VertexDataArray.dump", rFile::write); #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; @@ -1012,7 +1012,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw) void GLGSRender::DisableVertexData() { 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; glDisableVertexAttribArray(i); @@ -1910,7 +1910,7 @@ void GLGSRender::Draw() 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; @@ -1924,11 +1924,11 @@ void GLGSRender::Draw() 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; - glActiveTexture(GL_TEXTURE0 + m_textures_count + i); + glActiveTexture(GL_TEXTURE0 + rsx::limits::textures_count + i); checkForGlError("glActiveTexture"); m_gl_vertex_textures[i].Create(); m_gl_vertex_textures[i].Bind(); diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.h b/rpcs3/Emu/RSX/GL/GLGSRender.h index 4b669d533d..b327ad825c 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.h +++ b/rpcs3/Emu/RSX/GL/GLGSRender.h @@ -125,8 +125,8 @@ private: GLFragmentProgram m_fragment_prog; GLVertexProgram m_vertex_prog; - GLTexture m_gl_textures[m_textures_count]; - GLTexture m_gl_vertex_textures[m_textures_count]; + GLTexture m_gl_textures[rsx::limits::textures_count]; + GLTexture m_gl_vertex_textures[rsx::limits::vertex_textures_count]; GLvao m_vao; GLvbo m_vbo; diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 6eb3b5458b..8c73f44ef6 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -112,32 +112,25 @@ struct RSXTransformConstant 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: std::stack m_call_stack; CellGcmControl* m_ctrl; Timer m_timer_sync; public: - GcmTileInfo tiles[m_tiles_count]; - GcmZcullInfo zculls[m_zculls_count]; - rsx::texture m_textures[m_textures_count]; - rsx::vertex_texture m_vertex_textures[m_textures_count]; - RSXVertexData m_vertex_data[m_vertex_count]; + GcmTileInfo tiles[rsx::limits::tiles_count]; + GcmZcullInfo zculls[rsx::limits::zculls_count]; + rsx::texture m_textures[rsx::limits::textures_count]; + rsx::vertex_texture m_vertex_textures[rsx::limits::vertex_textures_count]; + RSXVertexData m_vertex_data[rsx::limits::vertex_count]; RSXIndexArrayData m_indexed_array; std::vector m_fragment_constants; std::vector m_transform_constants; 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; - RSXVertexProgram m_vertex_progs[m_vertex_count]; + RSXVertexProgram m_vertex_progs[rsx::limits::vertex_count]; RSXVertexProgram* m_cur_vertex_prog; public: @@ -650,7 +643,7 @@ protected: m_clear_surface_mask = 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); } @@ -729,7 +722,7 @@ protected: 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; diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index efc14a87a8..abb14413b7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -251,7 +251,7 @@ s32 cellGcmBindTile(u8 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"); return CELL_GCM_ERROR_INVALID_VALUE; @@ -267,7 +267,7 @@ s32 cellGcmBindZcull(u8 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"); 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)", 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"); 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)", 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"); return CELL_GCM_ERROR_INVALID_VALUE; @@ -652,7 +652,7 @@ s32 cellGcmUnbindTile(u8 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"); 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); // 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"); return CELL_GCM_ERROR_INVALID_VALUE; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index c7a4995dc4..bf892dc7f7 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -551,7 +551,7 @@ void RSXDebugger::GetTexture() const GSRender& render = Emu.GetGSManager().GetRender(); m_list_texture->DeleteAllItems(); - for(uint i=0; i