From 796e8a9f244bff0afd52c6998bc813ea8a45c8da Mon Sep 17 00:00:00 2001 From: SachinVin Date: Fri, 9 Jun 2023 22:48:16 +0530 Subject: [PATCH] video_core:fix warnings --- src/video_core/geometry_pipeline.cpp | 20 ++++++++++---------- src/video_core/pica.cpp | 9 ++++----- src/video_core/shader/shader.h | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/video_core/geometry_pipeline.cpp b/src/video_core/geometry_pipeline.cpp index bd46cc1ba..af64490bd 100644 --- a/src/video_core/geometry_pipeline.cpp +++ b/src/video_core/geometry_pipeline.cpp @@ -150,7 +150,7 @@ public: setup.uniforms.f[0] = Common::MakeVec(vertex_num, vertex_num, vertex_num, vertex_num); // The second uniform register and so on are used for receiving input vertices - buffer_cur = setup.uniforms.f + 1; + buffer_cur = setup.uniforms.f.data() + 1; main_vertex_num = regs.pipeline.variable_vertex_main_num_minus_1 + 1; total_vertex_num = val; @@ -200,7 +200,7 @@ private: template void save(Archive& ar, const unsigned int version) const { serialize_common(this, ar, version); - auto buffer_idx = static_cast(buffer_cur - setup.uniforms.f); + auto buffer_idx = static_cast(buffer_cur - setup.uniforms.f.data()); ar << buffer_idx; } @@ -209,7 +209,7 @@ private: serialize_common(this, ar, version); u32 buffer_idx; ar >> buffer_idx; - buffer_cur = setup.uniforms.f + buffer_idx; + buffer_cur = setup.uniforms.f.data() + buffer_idx; } BOOST_SERIALIZATION_SPLIT_MEMBER() @@ -229,7 +229,7 @@ public: vs_output_num = regs.pipeline.vs_outmap_total_minus_1_a + 1; ASSERT(vs_output_num == regs.pipeline.gs_config.stride_minus_1 + 1); std::size_t vertex_num = regs.pipeline.gs_config.fixed_vertex_num_minus_1 + 1; - buffer_cur = buffer_begin = setup.uniforms.f + regs.pipeline.gs_config.start_index; + buffer_cur = buffer_begin = setup.uniforms.f.data() + regs.pipeline.gs_config.start_index; buffer_end = buffer_begin + vs_output_num * vertex_num; } @@ -273,9 +273,9 @@ private: template void save(Archive& ar, const unsigned int version) const { serialize_common(this, ar, version); - auto buffer_offset = static_cast(buffer_begin - setup.uniforms.f); - auto buffer_idx = static_cast(buffer_cur - setup.uniforms.f); - auto buffer_size = static_cast(buffer_end - setup.uniforms.f); + auto buffer_offset = static_cast(buffer_begin - setup.uniforms.f.data()); + auto buffer_idx = static_cast(buffer_cur - setup.uniforms.f.data()); + auto buffer_size = static_cast(buffer_end - setup.uniforms.f.data()); ar << buffer_offset; ar << buffer_idx; ar << buffer_size; @@ -288,9 +288,9 @@ private: ar >> buffer_offset; ar >> buffer_idx; ar >> buffer_size; - buffer_begin = setup.uniforms.f + buffer_offset; - buffer_cur = setup.uniforms.f + buffer_idx; - buffer_end = setup.uniforms.f + buffer_size; + buffer_begin = setup.uniforms.f.data() + buffer_offset; + buffer_cur = setup.uniforms.f.data() + buffer_idx; + buffer_end = setup.uniforms.f.data() + buffer_size; } BOOST_SERIALIZATION_SPLIT_MEMBER() diff --git a/src/video_core/pica.cpp b/src/video_core/pica.cpp index 74f408c57..f0263136d 100644 --- a/src/video_core/pica.cpp +++ b/src/video_core/pica.cpp @@ -32,8 +32,7 @@ void Shutdown() { template void Zero(T& o) { - static_assert(std::is_trivially_copyable_v, - "It's undefined behavior to memset a non-trivially copyable type"); + static_assert(std::is_trivial_v, "It's undefined behavior to memset a non-trivial type"); memset(&o, 0, sizeof(o)); } @@ -56,10 +55,10 @@ State::State() : geometry_pipeline(*this) { void State::Reset() { Zero(regs); - Zero(vs); - Zero(gs); + vs = {}; + gs = {}; Zero(cmd_list); - Zero(immediate); + immediate = {}; primitive_assembler.Reconfigure(PipelineRegs::TriangleTopology::List); vs_float_regs_counter = 0; vs_uniform_write_buffer.fill(0); diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index dc98b7cab..7c998e68b 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -241,7 +241,7 @@ private: struct Uniforms { // The float uniforms are accessed by the shader JIT using SSE instructions, and are // therefore required to be 16-byte aligned. - alignas(16) Common::Vec4 f[96]; + alignas(16) std::array, 96> f; std::array b; std::array, 4> i;