From 3c802b06e9899685b744470c37ff48414f63c34f Mon Sep 17 00:00:00 2001 From: zawata Date: Sat, 27 Jun 2015 19:27:49 -0700 Subject: [PATCH 01/10] Citra_QT : Fix Conversion Warnings --- src/citra_qt/debugger/graphics_cmdlists.cpp | 2 +- src/citra_qt/debugger/profiler.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index cabf5fe07d..e15ed7dea5 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp @@ -168,7 +168,7 @@ GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(p } int GPUCommandListModel::rowCount(const QModelIndex& parent) const { - return pica_trace.writes.size(); + return static_cast(pica_trace.writes.size()); } int GPUCommandListModel::columnCount(const QModelIndex& parent) const { diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index 2ac1748b76..89b28c2f4c 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp @@ -74,7 +74,7 @@ int ProfilerModel::rowCount(const QModelIndex& parent) const if (parent.isValid()) { return 0; } else { - return results.time_per_category.size() + 2; + return static_cast(results.time_per_category.size() + 2); } } From 6e9a6ca6bf7cc32636f08772767890eba7aab1c6 Mon Sep 17 00:00:00 2001 From: zawata Date: Sat, 27 Jun 2015 19:28:58 -0700 Subject: [PATCH 02/10] Common : Fix Conversion Warnings --- src/common/string_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 2e80809abe..b2f7f7b1d0 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -313,7 +313,7 @@ static std::string UTF16ToUTF8(const std::wstring& input) std::string output; output.resize(size); - if (size == 0 || size != WideCharToMultiByte(CP_UTF8, 0, input.data(), input.size(), &output[0], output.size(), nullptr, nullptr)) + if (size == 0 || size != WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast(input.size()), &output[0], static_cast(output.size()), nullptr, nullptr)) output.clear(); return output; From 1be1ff23a9f6587d0867c11093d153e16f4b650c Mon Sep 17 00:00:00 2001 From: zawata Date: Sat, 27 Jun 2015 19:29:21 -0700 Subject: [PATCH 03/10] Core : Fix Conversion Warnings --- src/core/core_timing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 72006a53e9..20f2da0fe3 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -502,7 +502,7 @@ void Advance() { Core::g_app_core->down_count += diff; } if (advance_callback) - advance_callback(cycles_executed); + advance_callback(static_cast(cycles_executed)); } void LogPendingEvents() { From 716120da3d2f631edbb60638c2dd4b5400139c37 Mon Sep 17 00:00:00 2001 From: zawata Date: Sat, 27 Jun 2015 19:32:56 -0700 Subject: [PATCH 04/10] Video_Core : Fix Conversion Warnings --- src/video_core/command_processor.cpp | 2 +- src/video_core/debug_utils/debug_utils.cpp | 17 +---------------- src/video_core/vertex_shader.cpp | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index f2e3aee85e..51ab701597 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -103,7 +103,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) { case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[0], 0x23c): case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[1], 0x23d): { - unsigned index = id - PICA_REG_INDEX(command_buffer.trigger[0]); + unsigned index = static_cast(id - PICA_REG_INDEX(command_buffer.trigger[0])); u32* head_ptr = (u32*)Memory::GetPhysicalPointer(regs.command_buffer.GetPhysicalAddress(index)); g_state.cmd_list.head_ptr = g_state.cmd_list.current_ptr = head_ptr; g_state.cmd_list.length = regs.command_buffer.GetSize(index) / sizeof(u32); diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index d24c0f11e2..b492b24ada 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -85,7 +85,6 @@ void GeometryDumper::AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2) { vertices.push_back(v1); vertices.push_back(v2); - int num_vertices = vertices.size(); faces.push_back({ num_vertices-3, num_vertices-2, num_vertices-1 }); } @@ -241,8 +240,6 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data dvle.main_offset_words = main_offset; dvle.output_register_table_offset = write_offset - dvlb.dvle_offset; - dvle.output_register_table_size = output_info_table.size(); - QueueForWriting((u8*)output_info_table.data(), output_info_table.size() * sizeof(OutputRegisterInfo)); // TODO: Create a label table for "main" @@ -497,31 +494,19 @@ const Math::Vec4 LookupTexture(const u8* source, int x, int y, const Texture // Lookup base value Math::Vec3 ret; if (differential_mode) { - ret.r() = differential.r; - ret.g() = differential.g; - ret.b() = differential.b; + ret.r() = static_cast(differential.r); if (x >= 2) { - ret.r() += differential.dr; - ret.g() += differential.dg; - ret.b() += differential.db; } ret.r() = Color::Convert5To8(ret.r()); ret.g() = Color::Convert5To8(ret.g()); ret.b() = Color::Convert5To8(ret.b()); } else { if (x < 2) { - ret.r() = Color::Convert4To8(separate.r1); - ret.g() = Color::Convert4To8(separate.g1); - ret.b() = Color::Convert4To8(separate.b1); } else { - ret.r() = Color::Convert4To8(separate.r2); - ret.g() = Color::Convert4To8(separate.g2); - ret.b() = Color::Convert4To8(separate.b2); } } // Add modifier - unsigned table_index = (x < 2) ? table_index_1.Value() : table_index_2.Value(); static const std::array, 8> etc1_modifier_table = {{ { 2, 8 }, { 5, 17 }, { 9, 29 }, { 13, 42 }, diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 87006a832a..f074a3128a 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -96,7 +96,7 @@ static void ProcessShaderCode(VertexShaderState& state) { state.program_counter = &program_code[offset] - 1; // -1 to make sure when incrementing the PC we end up at the correct offset state.call_stack.push({ offset + num_instructions, return_offset, repeat_count, loop_increment, offset }); }; - u32 binary_offset = state.program_counter - program_code.data(); + u32 binary_offset = static_cast(state.program_counter - program_code.data()); state.debug.max_offset = std::max(state.debug.max_offset, 1 + binary_offset); From 017437e8d77048d40a1e764cc4c2b2c211233e47 Mon Sep 17 00:00:00 2001 From: zawata Date: Sat, 27 Jun 2015 19:35:13 -0700 Subject: [PATCH 05/10] Video_Core : Change Tabs to Spaces This really should be universalized, I keep getting errors creating commits because lines I've edited use tabs instead of spaces(and yes I did read the contributing guide and i know they are supposed to be spaces) --- src/video_core/debug_utils/debug_utils.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index b492b24ada..8f732242ef 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -85,6 +85,7 @@ void GeometryDumper::AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2) { vertices.push_back(v1); vertices.push_back(v2); + int num_vertices = static_cast(vertices.size()); faces.push_back({ num_vertices-3, num_vertices-2, num_vertices-1 }); } @@ -240,6 +241,8 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data dvle.main_offset_words = main_offset; dvle.output_register_table_offset = write_offset - dvlb.dvle_offset; + dvle.output_register_table_size = static_cast(output_info_table.size()); + QueueForWriting((u8*)output_info_table.data(), static_cast(output_info_table.size() * sizeof(OutputRegisterInfo))); // TODO: Create a label table for "main" @@ -495,18 +498,30 @@ const Math::Vec4 LookupTexture(const u8* source, int x, int y, const Texture Math::Vec3 ret; if (differential_mode) { ret.r() = static_cast(differential.r); + ret.g() = static_cast(differential.g); + ret.b() = static_cast(differential.b); if (x >= 2) { + ret.r() += static_cast(differential.dr); + ret.g() += static_cast(differential.dg); + ret.b() += static_cast(differential.db); } ret.r() = Color::Convert5To8(ret.r()); ret.g() = Color::Convert5To8(ret.g()); ret.b() = Color::Convert5To8(ret.b()); } else { if (x < 2) { + ret.r() = Color::Convert4To8(static_cast(separate.r1)); + ret.g() = Color::Convert4To8(static_cast(separate.g1)); + ret.b() = Color::Convert4To8(static_cast(separate.b1)); } else { + ret.r() = Color::Convert4To8(static_cast(separate.r2)); + ret.g() = Color::Convert4To8(static_cast(separate.g2)); + ret.b() = Color::Convert4To8(static_cast(separate.b2)); } } // Add modifier + unsigned table_index = static_cast((x < 2) ? table_index_1.Value() : table_index_2.Value()); static const std::array, 8> etc1_modifier_table = {{ { 2, 8 }, { 5, 17 }, { 9, 29 }, { 13, 42 }, From c66b5ca3d98d1171b254fb590bce9a71acbefe7f Mon Sep 17 00:00:00 2001 From: zawata Date: Sat, 27 Jun 2015 23:41:29 -0700 Subject: [PATCH 06/10] Citra_QT : Another Conversion Warning Fix --- src/citra_qt/debugger/graphics_vertex_shader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index 14d3f8f398..074418821c 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp @@ -34,7 +34,7 @@ int GraphicsVertexShaderModel::columnCount(const QModelIndex& parent) const { } int GraphicsVertexShaderModel::rowCount(const QModelIndex& parent) const { - return info.code.size(); + return static_cast(info.code.size()); } QVariant GraphicsVertexShaderModel::headerData(int section, Qt::Orientation orientation, int role) const { From f7050021dedd14f863cb914ba90f04fd0a188108 Mon Sep 17 00:00:00 2001 From: zawata Date: Sun, 28 Jun 2015 21:49:21 -0700 Subject: [PATCH 07/10] Video_Core: Finally fix pesky warning --- src/video_core/pica.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 026b10a628..2b7ad206b9 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -898,7 +898,7 @@ struct Regs { #define ADD_FIELD(name) \ do { \ - map.insert({PICA_REG_INDEX(name), #name}); \ + map.insert({static_cast(PICA_REG_INDEX(name)), #name}); \ /* TODO: change to Regs::name when VS2015 and other compilers support it */ \ for (u32 i = PICA_REG_INDEX(name) + 1; i < PICA_REG_INDEX(name) + sizeof(Regs().name) / 4; ++i) \ map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \ From 972dccc3f692adc113250d62531a774fecb9389c Mon Sep 17 00:00:00 2001 From: zawata Date: Mon, 29 Jun 2015 10:21:40 -0700 Subject: [PATCH 08/10] Core : Change variable type and fix various warnings --- src/core/loader/3dsx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp index d043fa9bd2..530837d088 100644 --- a/src/core/loader/3dsx.cpp +++ b/src/core/loader/3dsx.cpp @@ -191,7 +191,7 @@ static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr, Shared *pos = (addr); break; case 1: - *pos = (addr - in_addr); + *pos = static_cast(addr - in_addr); break; default: break; //this should never happen From 04756bdaf646abc6b75e62bf37f5a674bc6a64c4 Mon Sep 17 00:00:00 2001 From: zawata Date: Mon, 29 Jun 2015 11:32:53 -0700 Subject: [PATCH 09/10] Video_Core : Type fixes --- src/video_core/command_processor.cpp | 2 +- src/video_core/debug_utils/debug_utils.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 51ab701597..bfb00019a3 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -103,7 +103,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) { case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[0], 0x23c): case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[1], 0x23d): { - unsigned index = static_cast(id - PICA_REG_INDEX(command_buffer.trigger[0])); + unsigned index = static_cast(id - PICA_REG_INDEX(command_buffer.trigger[0])); u32* head_ptr = (u32*)Memory::GetPhysicalPointer(regs.command_buffer.GetPhysicalAddress(index)); g_state.cmd_list.head_ptr = g_state.cmd_list.current_ptr = head_ptr; g_state.cmd_list.length = regs.command_buffer.GetSize(index) / sizeof(u32); diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 8f732242ef..fc9faffc3e 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -85,7 +85,7 @@ void GeometryDumper::AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2) { vertices.push_back(v1); vertices.push_back(v2); - int num_vertices = static_cast(vertices.size()); + size_t num_vertices = vertices.size(); faces.push_back({ num_vertices-3, num_vertices-2, num_vertices-1 }); } From 6933a50aeb8ea6a2ff2c4d88068214b934771eab Mon Sep 17 00:00:00 2001 From: zawata Date: Sat, 18 Jul 2015 14:30:55 -0700 Subject: [PATCH 10/10] Vertex Shader : Undo casting --- src/video_core/vertex_shader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index f074a3128a..87006a832a 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -96,7 +96,7 @@ static void ProcessShaderCode(VertexShaderState& state) { state.program_counter = &program_code[offset] - 1; // -1 to make sure when incrementing the PC we end up at the correct offset state.call_stack.push({ offset + num_instructions, return_offset, repeat_count, loop_increment, offset }); }; - u32 binary_offset = static_cast(state.program_counter - program_code.data()); + u32 binary_offset = state.program_counter - program_code.data(); state.debug.max_offset = std::max(state.debug.max_offset, 1 + binary_offset);