From f0ba717142aa779a2b76f30cca2e16ac5d27b083 Mon Sep 17 00:00:00 2001 From: Vlad Ivanov Date: Wed, 25 Jan 2017 22:20:26 +0300 Subject: [PATCH 1/5] Fix a bunch of missing cmath includes ...as well as missing std:: namespace specifiers --- src/xenia/cpu/compiler/passes/constant_propagation_pass.cc | 5 +++-- src/xenia/gpu/command_processor.cc | 1 + src/xenia/gpu/texture_info.cc | 1 + third_party/llvm/include/llvm/Support/MathExtras.h | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc b/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc index e1234e13d..40bac4134 100644 --- a/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc +++ b/src/xenia/cpu/compiler/passes/constant_propagation_pass.cc @@ -10,6 +10,7 @@ #include "xenia/cpu/compiler/passes/constant_propagation_pass.h" #include +#include #include "xenia/base/assert.h" #include "xenia/base/profiling.h" @@ -303,10 +304,10 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) { case OPCODE_IS_NAN: if (i->src1.value->IsConstant()) { if (i->src1.value->type == FLOAT32_TYPE && - isnan(i->src1.value->constant.f32)) { + std::isnan(i->src1.value->constant.f32)) { v->set_constant(uint8_t(1)); } else if (i->src1.value->type == FLOAT64_TYPE && - isnan(i->src1.value->constant.f64)) { + std::isnan(i->src1.value->constant.f64)) { v->set_constant(uint8_t(1)); } else { v->set_constant(uint8_t(0)); diff --git a/src/xenia/gpu/command_processor.cc b/src/xenia/gpu/command_processor.cc index 2ca105c76..73f79923b 100644 --- a/src/xenia/gpu/command_processor.cc +++ b/src/xenia/gpu/command_processor.cc @@ -10,6 +10,7 @@ #include "xenia/gpu/command_processor.h" #include +#include #include "xenia/base/byte_stream.h" #include "xenia/base/logging.h" diff --git a/src/xenia/gpu/texture_info.cc b/src/xenia/gpu/texture_info.cc index 8c226f538..f7f0a5ed4 100644 --- a/src/xenia/gpu/texture_info.cc +++ b/src/xenia/gpu/texture_info.cc @@ -10,6 +10,7 @@ #include "xenia/gpu/texture_info.h" #include +#include #include #include "third_party/xxhash/xxhash.h" diff --git a/third_party/llvm/include/llvm/Support/MathExtras.h b/third_party/llvm/include/llvm/Support/MathExtras.h index 4d2ff0989..92b43bc88 100644 --- a/third_party/llvm/include/llvm/Support/MathExtras.h +++ b/third_party/llvm/include/llvm/Support/MathExtras.h @@ -18,8 +18,9 @@ #ifdef IGNORED_LLVM_XENIA #include "llvm/Support/SwapByteOrder.h" #endif // IGNORED_LLVM_XENIA -#include "llvm/Support/type_traits.h" +#include #include +#include "llvm/Support/type_traits.h" #ifdef _MSC_VER #include From 091c196fc7fa4bce3cc580623fdd1b83d1cd0f8a Mon Sep 17 00:00:00 2001 From: Vlad Ivanov Date: Wed, 25 Jan 2017 22:21:45 +0300 Subject: [PATCH 2/5] gpu: spirv_shader_translator: add missing cfloat include --- src/xenia/gpu/spirv_shader_translator.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index 77a31c66b..2182476ab 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -11,6 +11,7 @@ #include +#include #include #include "xenia/base/logging.h" From c74b84a18b97ae5c95ef5ba44abaf84f72fb26ab Mon Sep 17 00:00:00 2001 From: Vlad Ivanov Date: Wed, 25 Jan 2017 22:23:34 +0300 Subject: [PATCH 3/5] gpu: spirv_shader_translator: fix a number of missing VertexFormat cases --- src/xenia/gpu/spirv_shader_translator.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index 2182476ab..2b318ff46 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -241,8 +241,8 @@ void SpirvShaderTranslator::StartTranslation() { case VertexFormat::k_32_32: if (is_integer) { attrib_type = is_signed ? vec2_int_type_ : vec2_uint_type_; - break; } + break; case VertexFormat::k_16_16_FLOAT: case VertexFormat::k_32_32_FLOAT: attrib_type = vec2_float_type_; @@ -258,8 +258,8 @@ void SpirvShaderTranslator::StartTranslation() { case VertexFormat::k_32_32_32_32: if (is_integer) { attrib_type = is_signed ? vec4_int_type_ : vec4_uint_type_; - break; } + break; case VertexFormat::k_16_16_16_16_FLOAT: case VertexFormat::k_32_32_32_32_FLOAT: attrib_type = vec4_float_type_; @@ -1123,8 +1123,10 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction( switch (instr.attributes.data_format) { case VertexFormat::k_8_8_8_8: + case VertexFormat::k_2_10_10_10: case VertexFormat::k_16_16: case VertexFormat::k_16_16_16_16: + case VertexFormat::k_16_16_FLOAT: case VertexFormat::k_16_16_16_16_FLOAT: case VertexFormat::k_32: case VertexFormat::k_32_32: @@ -1211,6 +1213,9 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction( vec3_float_type_, std::vector({components[0], components[1], components[2]})); } break; + + case VertexFormat::kUndefined: + break; } // Convert any integers to floats. From d6bd1a9d21edfd69c77e9f8d4b342652dd9f057a Mon Sep 17 00:00:00 2001 From: Vlad Ivanov Date: Wed, 25 Jan 2017 22:27:12 +0300 Subject: [PATCH 4/5] gpu: trace_viewer: fix size_t format specifiers --- src/xenia/gpu/trace_viewer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xenia/gpu/trace_viewer.cc b/src/xenia/gpu/trace_viewer.cc index 3fa9907ec..5f0c5ac20 100644 --- a/src/xenia/gpu/trace_viewer.cc +++ b/src/xenia/gpu/trace_viewer.cc @@ -404,7 +404,7 @@ int TraceViewer::RecursiveDrawCommandBufferUI( } ImGui::PushID(int(i)); - if (ImGui::TreeNode((void*)0, "Indirect Buffer %d", i)) { + if (ImGui::TreeNode((void*)0, "Indirect Buffer %" PRIu64, i)) { ImGui::Indent(); auto id = RecursiveDrawCommandBufferUI( frame, buffer->commands[i].command_subtree.get()); @@ -1563,7 +1563,7 @@ void TraceViewer::DrawStateUI() { vertices.resize(size / 4); QueryVSOutput(vertices.data(), size); - ImGui::Text("%d output vertices", vertices.size() / 4); + ImGui::Text("%" PRIu64 " output vertices", vertices.size() / 4); ImGui::SameLine(); static bool normalize = false; ImGui::Checkbox("Normalize", &normalize); From bb9a26702d68d4fa31cc61eaf0cc59e50369c86e Mon Sep 17 00:00:00 2001 From: Vlad Ivanov Date: Wed, 25 Jan 2017 22:27:44 +0300 Subject: [PATCH 5/5] gpu: spirv_shader_translator: xb format changes --- src/xenia/gpu/spirv_shader_translator.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/xenia/gpu/spirv_shader_translator.h b/src/xenia/gpu/spirv_shader_translator.h index bdeb64940..0284e822b 100644 --- a/src/xenia/gpu/spirv_shader_translator.h +++ b/src/xenia/gpu/spirv_shader_translator.h @@ -96,9 +96,10 @@ class SpirvShaderTranslator : public ShaderTranslator { bool is_signed); // Creates a call to the given GLSL intrinsic. - spv::Id SpirvShaderTranslator::CreateGlslStd450InstructionCall( - spv::Decoration precision, spv::Id result_type, - spv::GLSLstd450 instruction_ordinal, std::vector args); + spv::Id CreateGlslStd450InstructionCall(spv::Decoration precision, + spv::Id result_type, + spv::GLSLstd450 instruction_ordinal, + std::vector args); // Loads an operand into a value. // The value returned will be in the form described in the operand (number of