From e029c9abdcee79bddb717bf13f86810c7201aa7b Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 1 Jan 2016 16:04:47 +0000 Subject: [PATCH] Cleaning up clang warnings in gpu/. --- src/xenia/gpu/spirv_shader_translator.cc | 40 +++++++++++------------- src/xenia/gpu/trace_player.h | 2 +- src/xenia/gpu/trace_reader.cc | 5 +-- src/xenia/gpu/trace_viewer.cc | 39 ++++++++++++++--------- src/xenia/gpu/trace_writer.cc | 3 +- 5 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index 0c461ea62..7919a3fe3 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -9,6 +9,8 @@ #include "xenia/gpu/spirv_shader_translator.h" +#include + namespace xe { namespace gpu { @@ -23,7 +25,7 @@ void SpirvShaderTranslator::StartTranslation() { auto float_1_0 = e.MakeFloatConstant(1.0f); auto acos = e.CreateGlslStd450InstructionCall( spv::Decoration::Invariant, e.MakeFloatType(32), spv::GLSLstd450::Acos, - {{float_1_0}}); + {float_1_0}); e.MakeReturn(true); } @@ -164,28 +166,22 @@ spv::Id SpirvShaderTranslator::LoadFromOperand(const InstructionOperand& op) { // storage_addressing_mode switch (op.storage_source) { case InstructionStorageSource::kRegister: - // - op.storage_index; + // TODO(benvanik): op.storage_index break; case InstructionStorageSource::kConstantFloat: - // - op.storage_index; + // TODO(benvanik): op.storage_index break; case InstructionStorageSource::kConstantInt: - // - op.storage_index; + // TODO(benvanik): op.storage_index break; case InstructionStorageSource::kConstantBool: - // - op.storage_index; + // TODO(benvanik): op.storage_index break; case InstructionStorageSource::kVertexFetchConstant: - // - op.storage_index; + // TODO(benvanik): op.storage_index break; case InstructionStorageSource::kTextureFetchConstant: - // - op.storage_index; + // TODO(benvanik): op.storage_index break; } @@ -217,25 +213,25 @@ void SpirvShaderTranslator::StoreToResult(spv::Id source_value_id, // storage_addressing_mode switch (result.storage_target) { case InstructionStorageTarget::kRegister: - // - result.storage_index; + // TODO(benvanik): result.storage_index break; case InstructionStorageTarget::kInterpolant: - // - result.storage_index; + // TODO(benvanik): result.storage_index break; case InstructionStorageTarget::kPosition: - // + // TODO(benvanik): result.storage_index break; case InstructionStorageTarget::kPointSize: - // + // TODO(benvanik): result.storage_index break; case InstructionStorageTarget::kColorTarget: - // - result.storage_index; + // TODO(benvanik): result.storage_index break; case InstructionStorageTarget::kDepth: - // + // TODO(benvanik): result.storage_index + break; + case InstructionStorageTarget::kNone: + assert_unhandled_case(result.storage_target); break; } diff --git a/src/xenia/gpu/trace_player.h b/src/xenia/gpu/trace_player.h index dee6967ff..d3926d460 100644 --- a/src/xenia/gpu/trace_player.h +++ b/src/xenia/gpu/trace_player.h @@ -59,7 +59,7 @@ class TracePlayer : public TraceReader { int current_frame_index_; int current_command_index_; bool playing_trace_ = false; - std::atomic playback_percent_ = 0; + std::atomic playback_percent_ = {0}; std::unique_ptr playback_event_; }; diff --git a/src/xenia/gpu/trace_reader.cc b/src/xenia/gpu/trace_reader.cc index 901e281a5..fb58c436b 100644 --- a/src/xenia/gpu/trace_reader.cc +++ b/src/xenia/gpu/trace_reader.cc @@ -127,8 +127,9 @@ void TraceReader::ParseTrace() { last_ptr = trace_ptr; break; } - case PacketCategory::kSwap: { - // + case PacketCategory::kSwap: + case PacketCategory::kGeneric: { + // Ignored. break; } } diff --git a/src/xenia/gpu/trace_viewer.cc b/src/xenia/gpu/trace_viewer.cc index 73bb4c72d..87225a156 100644 --- a/src/xenia/gpu/trace_viewer.cc +++ b/src/xenia/gpu/trace_viewer.cc @@ -11,6 +11,8 @@ #include +#include + #include "third_party/imgui/imgui.h" #include "xenia/base/clock.h" #include "xenia/base/logging.h" @@ -317,7 +319,7 @@ void TraceViewer::DrawPacketDisassemblerUI() { if (packet_info.predicated) { ImGui::PushStyleColor(ImGuiCol_Text, kColorIgnored); } - ImGui::BulletText(packet_info.type_info->name); + ImGui::BulletText("%s", packet_info.type_info->name); ImGui::TreePush((const char*)0); for (auto action : packet_info.actions) { switch (action.type) { @@ -338,11 +340,11 @@ void TraceViewer::DrawPacketDisassemblerUI() { break; } case PacketAction::Type::kSetBinMask: { - ImGui::Text("%.16llX", action.set_bin_mask.value); + ImGui::Text("%.16" PRIX64, action.set_bin_mask.value); break; } case PacketAction::Type::kSetBinSelect: { - ImGui::Text("%.16llX", action.set_bin_select.value); + ImGui::Text("%.16" PRIX64, action.set_bin_select.value); break; } } @@ -707,6 +709,9 @@ void TraceViewer::DrawVertexFetcher(Shader* shader, case VertexFormat::k_32_32_32_32_FLOAT: column_count += 4; break; + case VertexFormat::kUndefined: + assert_unhandled_case(attrib.fetch_instr.attributes.data_format); + break; } } ImGui::BeginChild("#indices", ImVec2(0, 300)); @@ -724,30 +729,30 @@ void TraceViewer::DrawVertexFetcher(Shader* shader, switch (attrib.fetch_instr.attributes.data_format) { case VertexFormat::k_32: case VertexFormat::k_32_FLOAT: - ImGui::Text("e%d.x", el_index); + ImGui::Text("e%" PRId64 ".x", el_index); ImGui::NextColumn(); break; case VertexFormat::k_16_16: case VertexFormat::k_16_16_FLOAT: case VertexFormat::k_32_32: case VertexFormat::k_32_32_FLOAT: - ImGui::Text("e%d.x", el_index); + ImGui::Text("e%" PRId64 ".x", el_index); ImGui::NextColumn(); - ImGui::Text("e%d.y", el_index); + ImGui::Text("e%" PRId64 ".y", el_index); ImGui::NextColumn(); break; case VertexFormat::k_10_11_11: case VertexFormat::k_11_11_10: case VertexFormat::k_32_32_32_FLOAT: - ImGui::Text("e%d.x", el_index); + ImGui::Text("e%" PRId64 ".x", el_index); ImGui::NextColumn(); - ImGui::Text("e%d.y", el_index); + ImGui::Text("e%" PRId64 ".y", el_index); ImGui::NextColumn(); - ImGui::Text("e%d.z", el_index); + ImGui::Text("e%" PRId64 ".z", el_index); ImGui::NextColumn(); break; case VertexFormat::k_8_8_8_8: - ImGui::Text("e%d.xyzw", el_index); + ImGui::Text("e%" PRId64 ".xyzw", el_index); ImGui::NextColumn(); break; case VertexFormat::k_2_10_10_10: @@ -755,15 +760,18 @@ void TraceViewer::DrawVertexFetcher(Shader* shader, case VertexFormat::k_32_32_32_32: case VertexFormat::k_16_16_16_16_FLOAT: case VertexFormat::k_32_32_32_32_FLOAT: - ImGui::Text("e%d.x", el_index); + ImGui::Text("e%" PRId64 ".x", el_index); ImGui::NextColumn(); - ImGui::Text("e%d.y", el_index); + ImGui::Text("e%" PRId64 ".y", el_index); ImGui::NextColumn(); - ImGui::Text("e%d.z", el_index); + ImGui::Text("e%" PRId64 ".z", el_index); ImGui::NextColumn(); - ImGui::Text("e%d.w", el_index); + ImGui::Text("e%" PRId64 ".w", el_index); ImGui::NextColumn(); break; + case VertexFormat::kUndefined: + assert_unhandled_case(attrib.fetch_instr.attributes.data_format); + break; } } ImGui::Separator(); @@ -865,6 +873,9 @@ void TraceViewer::DrawVertexFetcher(Shader* shader, ImGui::Text("%.2f", LOADEL(float, 3)); ImGui::NextColumn(); break; + case VertexFormat::kUndefined: + assert_unhandled_case(attrib.fetch_instr.attributes.data_format); + break; } } } diff --git a/src/xenia/gpu/trace_writer.cc b/src/xenia/gpu/trace_writer.cc index 927984038..5b19efeec 100644 --- a/src/xenia/gpu/trace_writer.cc +++ b/src/xenia/gpu/trace_writer.cc @@ -9,11 +9,12 @@ #include "xenia/gpu/trace_writer.h" +#include + #include "third_party/snappy/snappy-sinksource.h" #include "third_party/snappy/snappy.h" #include "build/version.h" - #include "xenia/base/assert.h" #include "xenia/base/logging.h" #include "xenia/base/string.h"