From fc04ca040fe53a0bfc08bf5992dc1ab50ad2d816 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 10:17:17 -0500 Subject: [PATCH 01/17] Fix building with profiling disabled --- src/xenia/base/profiling.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xenia/base/profiling.cc b/src/xenia/base/profiling.cc index 742a6a279..3a03e15ea 100644 --- a/src/xenia/base/profiling.cc +++ b/src/xenia/base/profiling.cc @@ -37,10 +37,8 @@ #include "third_party/microprofile/microprofileui.h" #endif // XE_OPTION_PROFILING -#if XE_OPTION_PROFILING_UI #undef DrawText #include "xenia/ui/microprofile_drawer.h" -#endif // XE_OPTION_PROFILING_UI DEFINE_bool(show_profiler, false, "Show profiling UI by default."); @@ -261,7 +259,9 @@ void Profiler::OnMouseDown(bool left_button, bool right_button) {} void Profiler::OnMouseUp() {} void Profiler::OnMouseMove(int x, int y) {} void Profiler::OnMouseWheel(int x, int y, int dy) {} -void Profiler::set_display(std::unique_ptr display) {} +void Profiler::ToggleDisplay() {} +void Profiler::TogglePause() {} +void Profiler::set_window(ui::Window* window) {} void Profiler::Present() {} #endif // XE_OPTION_PROFILING From fa953fe758bda3b983524d7a235a318dc1895680 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 10:37:01 -0500 Subject: [PATCH 02/17] bit_map: Add missing include for size_t definition --- src/xenia/base/bit_map.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xenia/base/bit_map.h b/src/xenia/base/bit_map.h index e80ad93b6..29bbb3925 100644 --- a/src/xenia/base/bit_map.h +++ b/src/xenia/base/bit_map.h @@ -10,6 +10,7 @@ #ifndef XENIA_BASE_BIT_MAP_H_ #define XENIA_BASE_BIT_MAP_H_ +#include #include #include @@ -52,4 +53,4 @@ class BitMap { } // namespace xe -#endif // XENIA_BASE_BIT_MAP_H_ \ No newline at end of file +#endif // XENIA_BASE_BIT_MAP_H_ From a743c12e7202055463604792a546df3b1183b68b Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 11:02:26 -0500 Subject: [PATCH 03/17] byte_stream: add missing include for memcpy --- src/xenia/base/byte_stream.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xenia/base/byte_stream.cc b/src/xenia/base/byte_stream.cc index abc49c1ba..98599e02b 100644 --- a/src/xenia/base/byte_stream.cc +++ b/src/xenia/base/byte_stream.cc @@ -9,6 +9,8 @@ #include "xenia/base/byte_stream.h" +#include + #include "xenia/base/assert.h" namespace xe { @@ -34,4 +36,4 @@ void ByteStream::Write(const uint8_t* buf, size_t len) { Advance(len); } -} // namespace xe \ No newline at end of file +} // namespace xe From d982b54bda3ab038201b819df211800f8ea2b0a2 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 11:05:04 -0500 Subject: [PATCH 04/17] byte_stream: Remove template specialization in class scope --- src/xenia/base/byte_stream.cc | 20 ++++++++++++++++++++ src/xenia/base/byte_stream.h | 28 +++++++--------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/xenia/base/byte_stream.cc b/src/xenia/base/byte_stream.cc index 98599e02b..652b5c0df 100644 --- a/src/xenia/base/byte_stream.cc +++ b/src/xenia/base/byte_stream.cc @@ -36,4 +36,24 @@ void ByteStream::Write(const uint8_t* buf, size_t len) { Advance(len); } +template <> +std::string ByteStream::Read() { + std::string str; + uint32_t len = Read(); + str.resize(len); + + Read(reinterpret_cast(&str[0]), len); + return str; +} + +template <> +std::wstring ByteStream::Read() { + std::wstring str; + uint32_t len = Read(); + str.resize(len); + + Read(reinterpret_cast(&str[0]), len * 2); + return str; +} + } // namespace xe diff --git a/src/xenia/base/byte_stream.h b/src/xenia/base/byte_stream.h index 479be9760..d97568b28 100644 --- a/src/xenia/base/byte_stream.h +++ b/src/xenia/base/byte_stream.h @@ -46,26 +46,6 @@ class ByteStream { return data; } - template <> - std::string Read() { - std::string str; - uint32_t len = Read(); - str.resize(len); - - Read(reinterpret_cast(&str[0]), len); - return str; - } - - template <> - std::wstring Read() { - std::wstring str; - uint32_t len = Read(); - str.resize(len); - - Read(reinterpret_cast(&str[0]), len * 2); - return str; - } - template void Write(T data) { Write(reinterpret_cast(&data), sizeof(T)); @@ -87,6 +67,12 @@ class ByteStream { size_t offset_ = 0; }; +template <> +std::string ByteStream::Read(); + +template <> +std::wstring ByteStream::Read(); + } // namespace xe -#endif // XENIA_BASE_BYTE_STREAM_H_ \ No newline at end of file +#endif // XENIA_BASE_BYTE_STREAM_H_ From 16ade60d372c1d650602960848a853333b499820 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 11:08:47 -0500 Subject: [PATCH 05/17] Pass a C string for logging argument --- src/xenia/emulator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index f1d219a9f..8fbf5f98f 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -504,7 +504,7 @@ X_STATUS Emulator::CompleteLaunch(const std::wstring& path, XELOGI("Launching module %s", next_module.c_str()); auto module = kernel_state_->LoadUserModule(next_module.c_str()); if (!module) { - XELOGE("Failed to load user module %s", path); + XELOGE("Failed to load user module %s", path.c_str()); return X_STATUS_NOT_FOUND; } From da71bc26a2f5ba9081e0373dc97f2b8c7c6cf966 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 11:18:11 -0500 Subject: [PATCH 06/17] Use correct value in unhandled case assert --- src/xenia/cpu/hir/value.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/cpu/hir/value.cc b/src/xenia/cpu/hir/value.cc index e0be35b58..a41b8c9a8 100644 --- a/src/xenia/cpu/hir/value.cc +++ b/src/xenia/cpu/hir/value.cc @@ -215,7 +215,7 @@ void Value::Convert(TypeName target_type, RoundMode round_mode) { return; } default: - assert_unhandled_case(target_type); + assert_unhandled_case(type); return; } } From 3f49aa3cef7f8559d430dd172d1258c69584505d Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 11:29:16 -0500 Subject: [PATCH 07/17] Add default case for unhandled target_type values --- src/xenia/cpu/hir/value.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xenia/cpu/hir/value.cc b/src/xenia/cpu/hir/value.cc index a41b8c9a8..03ef79a2a 100644 --- a/src/xenia/cpu/hir/value.cc +++ b/src/xenia/cpu/hir/value.cc @@ -206,6 +206,9 @@ void Value::Convert(TypeName target_type, RoundMode round_mode) { type = target_type; constant.f64 = constant.f32; return; + default: + assert_unhandled_case(target_type); + return; } case FLOAT64_TYPE: switch (target_type) { @@ -213,6 +216,9 @@ void Value::Convert(TypeName target_type, RoundMode round_mode) { type = target_type; constant.f32 = (float)constant.f64; return; + default: + assert_unhandled_case(target_type); + return; } default: assert_unhandled_case(type); From 9451c0b1cf9d542c196433ee03efac2cbfde4d00 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 12:15:52 -0500 Subject: [PATCH 08/17] Fix different types in std::min arguments --- src/xenia/cpu/processor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/cpu/processor.cc b/src/xenia/cpu/processor.cc index f292ef6ce..f9304bc83 100644 --- a/src/xenia/cpu/processor.cc +++ b/src/xenia/cpu/processor.cc @@ -338,7 +338,7 @@ uint64_t Processor::Execute(ThreadState* thread_state, uint32_t address, SCOPE_profile_cpu_f("cpu"); auto context = thread_state->context(); - for (size_t i = 0; i < std::min(arg_count, 8ull); ++i) { + for (size_t i = 0; i < std::min(arg_count, static_cast(8)); ++i) { context->r[3 + i] = args[i]; } From 058ae01568d0c9e31564db359910481c1c15af6d Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 12:24:21 -0500 Subject: [PATCH 09/17] Add default case which ignores other mouse buttons --- src/xenia/ui/imgui_drawer.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xenia/ui/imgui_drawer.cc b/src/xenia/ui/imgui_drawer.cc index c79870250..6507699e7 100644 --- a/src/xenia/ui/imgui_drawer.cc +++ b/src/xenia/ui/imgui_drawer.cc @@ -274,6 +274,9 @@ void ImGuiDrawer::OnMouseDown(MouseEvent* e) { case xe::ui::MouseEvent::Button::kRight: { io.MouseDown[1] = true; } break; + default: { + // Ignored. + } break; } } @@ -292,6 +295,9 @@ void ImGuiDrawer::OnMouseUp(MouseEvent* e) { case xe::ui::MouseEvent::Button::kRight: { io.MouseDown[1] = false; } break; + default: { + // Ignored. + } break; } } From 235f58d75708fbfed14ddfa377512d592bb7723c Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 12:28:18 -0500 Subject: [PATCH 10/17] Add missing include for std::find --- src/xenia/ui/window.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xenia/ui/window.cc b/src/xenia/ui/window.cc index 0d27eaec0..0a3c1993b 100644 --- a/src/xenia/ui/window.cc +++ b/src/xenia/ui/window.cc @@ -9,6 +9,8 @@ #include "xenia/ui/window.h" +#include + #include "third_party/imgui/imgui.h" #include "xenia/base/assert.h" #include "xenia/base/clock.h" From fe30941c9bf189202f2aebdd4940900aff576514 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 14:18:35 -0500 Subject: [PATCH 11/17] debug_window: Use a string literal as a format string Fixes clang "format-security" error. --- src/xenia/debug/ui/debug_window.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xenia/debug/ui/debug_window.cc b/src/xenia/debug/ui/debug_window.cc index 1b07b2bd7..e7005391f 100644 --- a/src/xenia/debug/ui/debug_window.cc +++ b/src/xenia/debug/ui/debug_window.cc @@ -318,7 +318,7 @@ void DebugWindow::DrawSourcePane() { // name text box (editable) // combo for interleaved + [ppc, hir, opt hir, x64 + byte with sizes] ImGui::AlignFirstTextHeightToWidgets(); - ImGui::Text(function->module()->name().c_str()); + ImGui::Text("%s", function->module()->name().c_str()); ImGui::SameLine(); ImGui::Dummy(ImVec2(4, 0)); ImGui::SameLine(); @@ -657,7 +657,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, uint32_t* value) { auto alt_value = state_.register_input_hex ? std::to_string(*value) : string_util::to_hex_string(*value); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } return any_changed; } @@ -697,7 +697,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, uint64_t* value) { auto alt_value = state_.register_input_hex ? std::to_string(*value) : string_util::to_hex_string(*value); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } return any_changed; } @@ -736,7 +736,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, double* value) { auto alt_value = state_.register_input_hex ? std::to_string(*value) : string_util::to_hex_string(*value); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } return any_changed; } @@ -779,7 +779,7 @@ bool DebugWindow::DrawRegisterTextBoxes(int id, float* value) { auto alt_value = state_.register_input_hex ? std::to_string(value[i]) : string_util::to_hex_string(value[i]); - ImGui::SetTooltip(alt_value.c_str()); + ImGui::SetTooltip("%s", alt_value.c_str()); } if (i < 3) { ImGui::SameLine(); @@ -1067,9 +1067,9 @@ void DebugWindow::DrawThreadsPane() { ImGui::Dummy(ImVec2(8, 0)); ImGui::SameLine(); if (frame.guest_function) { - ImGui::Text(frame.guest_function->name().c_str()); + ImGui::Text("%s", frame.guest_function->name().c_str()); } else { - ImGui::Text(frame.name); + ImGui::Text("%s", frame.name); } if (is_current_thread && !frame.guest_pc) { ImGui::PopStyleColor(); @@ -1259,7 +1259,7 @@ void DebugWindow::DrawBreakpointsPane() { ImGui::SameLine(); ImGui::Dummy(ImVec2(4, 0)); ImGui::SameLine(); - ImGui::Text(export_entry->name); + ImGui::Text("%s", export_entry->name); ImGui::Dummy(ImVec2(0, 1)); ImGui::PopID(); } From 6b31ddfb428d1ee142ccb9cf3b32a3c53ba95818 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 14:22:50 -0500 Subject: [PATCH 12/17] debug_window: Use correct format specifier for double value Specifier 'LF' is 'long double'. --- src/xenia/debug/ui/debug_window.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/debug/ui/debug_window.cc b/src/xenia/debug/ui/debug_window.cc index e7005391f..0c1996c1f 100644 --- a/src/xenia/debug/ui/debug_window.cc +++ b/src/xenia/debug/ui/debug_window.cc @@ -715,7 +715,7 @@ bool DebugWindow::DrawRegisterTextBox(int id, double* value) { } else { input_flags |= ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll; - std::snprintf(buffer, xe::countof(buffer), "%.8LF", *value); + std::snprintf(buffer, xe::countof(buffer), "%.8F", *value); } char label[16] = {0}; std::snprintf(label, xe::countof(label), "##dregister%d", id); From b0bce0d9ab92f65b336d4fbc133571a8f4ba9a11 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 14:25:41 -0500 Subject: [PATCH 13/17] debug_window: Ignore other breakpoint types In the breakpoints pane, add a default case for breakpoint types that ignores the other possible types. --- src/xenia/debug/ui/debug_window.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xenia/debug/ui/debug_window.cc b/src/xenia/debug/ui/debug_window.cc index 0c1996c1f..7a80528a6 100644 --- a/src/xenia/debug/ui/debug_window.cc +++ b/src/xenia/debug/ui/debug_window.cc @@ -1344,6 +1344,10 @@ void DebugWindow::DrawBreakpointsPane() { } break; } + default: { + // Ignored. + break; + } } } if (ImGui::BeginPopupContextItem("##breakpoint_context_menu")) { From ee8e6e88228581b28e7d9198ec25b0c079d0204d Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 14:35:26 -0500 Subject: [PATCH 14/17] debug_window: Use function to store from '__m128' variable. --- src/xenia/debug/ui/debug_window.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xenia/debug/ui/debug_window.cc b/src/xenia/debug/ui/debug_window.cc index 7a80528a6..a63fafbd8 100644 --- a/src/xenia/debug/ui/debug_window.cc +++ b/src/xenia/debug/ui/debug_window.cc @@ -959,6 +959,8 @@ void DebugWindow::DrawRegistersPane() { case RegisterGroup::kHostVector: { ImGui::BeginChild("##host_vector"); for (int i = 0; i < 16; ++i) { + float f[4]; + _mm_storeu_ps(f, thread_info->host_context.xmm_registers[i]); auto reg = static_cast(static_cast(X64Register::kXmm0) + i); ImGui::BeginGroup(); @@ -967,8 +969,7 @@ void DebugWindow::DrawRegistersPane() { ImGui::SameLine(); ImGui::Dummy(ImVec2(4, 0)); ImGui::SameLine(); - dirty_host_context |= DrawRegisterTextBoxes( - i, thread_info->host_context.xmm_registers[i].m128_f32); + dirty_host_context |= DrawRegisterTextBoxes(i, f); ImGui::EndGroup(); } ImGui::EndChild(); From 962d8215da059d1fd72f30cb434f8c07ea3fce88 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 15:51:32 -0500 Subject: [PATCH 15/17] shader_translator: Handle all enum values in switch-cases --- src/xenia/gpu/glsl_shader_translator.cc | 12 ++++++++++++ src/xenia/gpu/shader_translator.cc | 14 +++++++++++++- src/xenia/gpu/shader_translator_disasm.cc | 6 ++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/xenia/gpu/glsl_shader_translator.cc b/src/xenia/gpu/glsl_shader_translator.cc index 423ba191d..397dd3a63 100644 --- a/src/xenia/gpu/glsl_shader_translator.cc +++ b/src/xenia/gpu/glsl_shader_translator.cc @@ -559,6 +559,9 @@ void GlslShaderTranslator::ProcessVertexFetchInstruction( EmitSource(" = vf%u_%d;\n", instr.operands[1].storage_index, instr.attributes.offset); break; + default: + assert_always(); + break; } } @@ -676,6 +679,9 @@ void GlslShaderTranslator::ProcessTextureFetchInstruction( EmitUnimplementedTranslationError(); EmitSourceDepth("pv = vec4(0.0);\n"); break; + case FetchOpcode::kVertexFetch: + assert_always(); + break; } EmitStoreVectorResult(instr.result); @@ -728,6 +734,10 @@ void GlslShaderTranslator::EmitLoadOperand(size_t i, case InstructionStorageSource::kConstantBool: EmitSource("state.bool_consts"); break; + case InstructionStorageSource::kTextureFetchConstant: + case InstructionStorageSource::kVertexFetchConstant: + assert_always(); + break; } switch (op.storage_addressing_mode) { case InstructionStorageAddressingMode::kStatic: @@ -815,6 +825,8 @@ void GlslShaderTranslator::EmitStoreResult(const InstructionResult& result, case InstructionStorageTarget::kDepth: EmitSourceDepth("gl_FragDepth"); break; + case InstructionStorageTarget::kNone: + break; } if (uses_storage_index) { switch (result.storage_addressing_mode) { diff --git a/src/xenia/gpu/shader_translator.cc b/src/xenia/gpu/shader_translator.cc index f4e7376df..71d9b419d 100644 --- a/src/xenia/gpu/shader_translator.cc +++ b/src/xenia/gpu/shader_translator.cc @@ -159,7 +159,7 @@ void ShaderTranslator::GatherBindingInformation( case ControlFlowOpcode::kCondExecPred: case ControlFlowOpcode::kCondExecPredEnd: case ControlFlowOpcode::kCondExecPredClean: - case ControlFlowOpcode::kCondExecPredCleanEnd: + case ControlFlowOpcode::kCondExecPredCleanEnd: { uint32_t sequence = cf.exec.sequence(); for (uint32_t instr_offset = cf.exec.address(); instr_offset < cf.exec.address() + cf.exec.count(); @@ -195,6 +195,8 @@ void ShaderTranslator::GatherBindingInformation( } } } + } break; + default: break; } } @@ -248,6 +250,9 @@ void ShaderTranslator::GatherTextureBindingInformation( case FetchOpcode::kSetTextureGradientsVert: // Doesn't use bindings. return; + default: + // Continue. + break; } Shader::TextureBinding binding; binding.binding_index = texture_bindings_.size(); @@ -271,6 +276,9 @@ void AddControlFlowTargetLabel(const ControlFlowInstruction& cf, case ControlFlowOpcode::kCondJmp: label_addresses->insert(cf.cond_jmp.address()); break; + default: + // Ignored. + break; } } @@ -435,6 +443,8 @@ void ShaderTranslator::TranslateControlFlowCondExec( i.opcode_name = "cexece"; i.is_end = true; break; + default: + break; } i.instruction_address = cf.address(); i.instruction_count = cf.count(); @@ -446,6 +456,8 @@ void ShaderTranslator::TranslateControlFlowCondExec( case ControlFlowOpcode::kCondExecEnd: i.clean = false; break; + default: + break; } i.is_yield = cf.is_yield(); i.sequence = cf.sequence(); diff --git a/src/xenia/gpu/shader_translator_disasm.cc b/src/xenia/gpu/shader_translator_disasm.cc index 4f4022f6e..8e1bdb996 100644 --- a/src/xenia/gpu/shader_translator_disasm.cc +++ b/src/xenia/gpu/shader_translator_disasm.cc @@ -45,6 +45,8 @@ void DisassembleResultOperand(const InstructionResult& result, case InstructionStorageTarget::kDepth: out->Append("oDepth"); break; + case InstructionStorageTarget::kNone: + break; } if (uses_storage_index) { switch (result.storage_addressing_mode) { @@ -90,6 +92,10 @@ void DisassembleSourceOperand(const InstructionOperand& op, StringBuffer* out) { case InstructionStorageSource::kConstantBool: out->Append('b'); break; + case InstructionStorageSource::kTextureFetchConstant: + case InstructionStorageSource::kVertexFetchConstant: + assert_always(); + break; } if (op.is_absolute_value) { out->Append("_abs"); From f3fc50c8db85b6277d646bd670767713911b9ec3 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 15:59:45 -0500 Subject: [PATCH 16/17] shader: Fix print format for hash --- src/xenia/gpu/shader.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/xenia/gpu/shader.cc b/src/xenia/gpu/shader.cc index c2fc1f25d..3e0be41f9 100644 --- a/src/xenia/gpu/shader.cc +++ b/src/xenia/gpu/shader.cc @@ -9,6 +9,7 @@ #include "xenia/gpu/shader.h" +#include #include #include "xenia/base/filesystem.h" @@ -47,8 +48,8 @@ void Shader::Dump(const std::string& base_path, const char* path_prefix) { char txt_file_name[kMaxPath]; std::snprintf(txt_file_name, xe::countof(txt_file_name), - "%s/shader_%s_%.16llX.%s", base_path.c_str(), path_prefix, - ucode_data_hash_, + "%s/shader_%s_%.16" PRIX64 ".%s", base_path.c_str(), + path_prefix, ucode_data_hash_, shader_type_ == ShaderType::kVertex ? "vert" : "frag"); FILE* f = fopen(txt_file_name, "w"); if (f) { @@ -70,8 +71,8 @@ void Shader::Dump(const std::string& base_path, const char* path_prefix) { char bin_file_name[kMaxPath]; std::snprintf(bin_file_name, xe::countof(bin_file_name), - "%s/shader_%s_%.16llX.bin.%s", base_path.c_str(), path_prefix, - ucode_data_hash_, + "%s/shader_%s_%.16" PRIX64 ".bin.%s", base_path.c_str(), + path_prefix, ucode_data_hash_, shader_type_ == ShaderType::kVertex ? "vert" : "frag"); f = fopen(bin_file_name, "w"); if (f) { From f5d4941716506a24d9492f8724e63bdf84ef8eb5 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 16:09:03 -0500 Subject: [PATCH 17/17] shader_translator: Remove always true expression vector_dest() returns an unsigned value, it will always be >= 0. --- src/xenia/gpu/shader_translator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xenia/gpu/shader_translator.cc b/src/xenia/gpu/shader_translator.cc index 71d9b419d..689bcbf97 100644 --- a/src/xenia/gpu/shader_translator.cc +++ b/src/xenia/gpu/shader_translator.cc @@ -184,12 +184,12 @@ void ShaderTranslator::GatherBindingInformation( auto& op = *reinterpret_cast(ucode_dwords_ + instr_offset * 3); if (op.has_vector_op() && op.is_export()) { - if (op.vector_dest() >= 0 && op.vector_dest() <= 3) { + if (op.vector_dest() <= 3) { writes_color_targets_[op.vector_dest()] = true; } } if (op.has_scalar_op() && op.is_export()) { - if (op.vector_dest() >= 0 && op.vector_dest() <= 3) { + if (op.vector_dest() <= 3) { writes_color_targets_[op.vector_dest()] = true; } }