From 3a9ae2df9e98b4965c252aaaef8b69853d5ae531 Mon Sep 17 00:00:00 2001 From: Zion Nimchuk Date: Wed, 1 Nov 2017 23:29:17 -0700 Subject: [PATCH] silence warnings in RSX stuff --- rpcs3/Emu/RSX/Common/BufferUtils.cpp | 22 +++++++++++++++------- rpcs3/Emu/RSX/Common/ProgramStateCache.h | 3 ++- rpcs3/Emu/RSX/Common/texture_cache.h | 14 +++++++------- rpcs3/Emu/RSX/GL/GLHelpers.cpp | 9 +++++++-- rpcs3/Emu/RSX/GL/GLHelpers.h | 11 ++++++++--- rpcs3/Emu/RSX/GL/GLTextureCache.h | 2 ++ rpcs3/Emu/RSX/RSXThread.cpp | 10 +++++----- 7 files changed, 46 insertions(+), 25 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index 80f383a729..fb08421931 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -38,8 +38,8 @@ namespace { const __m128i mask = _mm_set_epi8( 0xC, 0xD, 0xE, 0xF, - 0x8, 0x9, 0xA, 0xB, - 0x4, 0x5, 0x6, 0x7, + 0x8, 0x9, 0xA, 0xB, + 0x4, 0x5, 0x6, 0x7, 0x0, 0x1, 0x2, 0x3); __m128i* dst_ptr = (__m128i*)dst; @@ -48,7 +48,7 @@ namespace const u32 dword_count = (vertex_count * (stride >> 2)); const u32 iterations = dword_count >> 2; const u32 remaining = dword_count % 4; - + for (u32 i = 0; i < iterations; ++i) { u32 *src_words = (u32*)src_ptr; @@ -121,7 +121,7 @@ namespace //Count vertices to copy const bool is_128_aligned = !((dst_stride | src_stride) & 15); - + u32 min_block_size = std::min(src_stride, dst_stride); if (min_block_size == 0) min_block_size = dst_stride; @@ -382,9 +382,9 @@ void write_vertex_array_data_to_buffer(gsl::span raw_dst_span, gsl::s const u64 src_address = (u64)src_ptr.data(); const bool sse_aligned = ((src_address & 15) == 0); - + #if !DEBUG_VERTEX_STREAMING - + if (real_count >= count || real_count == 1) { if (attribute_src_stride == dst_stride && src_read_stride == dst_stride) @@ -604,7 +604,10 @@ bool is_primitive_native(rsx::primitive_type draw_mode) case rsx::primitive_type::triangle_fan: case rsx::primitive_type::quads: return false; + case rsx::primitive_type::invalid: + break; } + fmt::throw_exception("Wrong primitive type" HERE); } @@ -682,7 +685,11 @@ void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, case rsx::primitive_type::triangles: case rsx::primitive_type::triangle_strip: fmt::throw_exception("Native primitive type doesn't require expansion" HERE); + case rsx::primitive_type::invalid: + break; } + + fmt::throw_exception("Tried to load invalid primitive type" HERE); } @@ -725,8 +732,9 @@ namespace return expand_indexed_triangle_fan(src, dst, restart_index_enabled, restart_index); case rsx::primitive_type::quads: return expand_indexed_quads(src, dst, restart_index_enabled, restart_index); + default: + fmt::throw_exception("Unknown draw mode (0x%x)" HERE, (u32)draw_mode); } - fmt::throw_exception("Unknown draw mode (0x%x)" HERE, (u32)draw_mode); } } diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.h b/rpcs3/Emu/RSX/Common/ProgramStateCache.h index b3cb6562a3..121cb15b00 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.h +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.h @@ -327,7 +327,8 @@ public: for (auto& e : patch_table.db) { //TODO: Use fp comparison with fabsf without hurting performance - if (patched = e.second.test_and_set(tmp[i], &dst[i])) + patched = e.second.test_and_set(tmp[i], &dst[i]); + if (patched) { break; } diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 5bca981ae4..a8fee6e784 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -138,7 +138,7 @@ namespace rsx class texture_cache { private: - std::pair, std::array> default_remap_vector = + std::pair, std::array> default_remap_vector = { { CELL_GCM_TEXTURE_REMAP_FROM_A, CELL_GCM_TEXTURE_REMAP_FROM_R, CELL_GCM_TEXTURE_REMAP_FROM_G, CELL_GCM_TEXTURE_REMAP_FROM_B }, { CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP } @@ -271,12 +271,12 @@ namespace rsx //Set when a hw blit engine incompatibility is detected bool blit_engine_incompatibility_warning_raised = false; - + //Memory usage const s32 m_max_zombie_objects = 64; //Limit on how many texture objects to keep around for reuse after they are invalidated std::atomic m_unreleased_texture_objects = { 0 }; //Number of invalidated objects not yet freed from memory std::atomic m_texture_memory_in_use = { 0 }; - + /* Helpers */ virtual void free_texture_section(section_storage_type&) = 0; virtual image_view_type create_temporary_subresource_view(commandbuffer_type&, image_resource_type* src, u32 gcm_format, u16 x, u16 y, u16 w, u16 h) = 0; @@ -606,7 +606,7 @@ namespace rsx texture_cache() {} ~texture_cache() {} - + virtual void destroy() = 0; virtual bool is_depth_texture(const u32, const u32) = 0; virtual void on_frame_end() = 0; @@ -768,7 +768,7 @@ namespace rsx region->copy_texture(false, std::forward(extra)...); return true; } - + template bool load_memory_from_cache(const u32 memory_address, const u32 memory_size, Args&&... extras) { @@ -970,7 +970,7 @@ namespace rsx value.misses--; } } - + void purge_dirty() { writer_lock lock(m_cache_mutex); @@ -1001,7 +1001,7 @@ namespace rsx { m_cache.erase(address); } - + m_unreleased_texture_objects = 0; } diff --git a/rpcs3/Emu/RSX/GL/GLHelpers.cpp b/rpcs3/Emu/RSX/GL/GLHelpers.cpp index 1693d56ffa..b5e4f08996 100644 --- a/rpcs3/Emu/RSX/GL/GLHelpers.cpp +++ b/rpcs3/Emu/RSX/GL/GLHelpers.cpp @@ -22,8 +22,9 @@ namespace gl case rsx::primitive_type::quads: return GL_TRIANGLES; case rsx::primitive_type::quad_strip: return GL_TRIANGLE_STRIP; case rsx::primitive_type::polygon: return GL_TRIANGLES; + default: + fmt::throw_exception("unknown primitive type" HERE); } - fmt::throw_exception("unknow primitive type" HERE); } #ifdef WIN32 @@ -320,6 +321,9 @@ namespace gl case texture::internal_format::compressed_rgba_s3tc_dxt5: compressed_image_size = ((m_width + 3) / 4) * ((m_height + 3) / 4) * 16; break; + default: + fmt::throw_exception("Tried to load unimplemented internal_format type." HERE); + break; } } @@ -549,7 +553,8 @@ namespace gl case rsx::primitive_type::quads: case rsx::primitive_type::polygon: return false; + default: + fmt::throw_exception("unknown primitive type" HERE); } - fmt::throw_exception("unknown primitive type" HERE); } } diff --git a/rpcs3/Emu/RSX/GL/GLHelpers.h b/rpcs3/Emu/RSX/GL/GLHelpers.h index df9f632e63..7779ab3309 100644 --- a/rpcs3/Emu/RSX/GL/GLHelpers.h +++ b/rpcs3/Emu/RSX/GL/GLHelpers.h @@ -1379,9 +1379,9 @@ namespace gl case internal_format::compressed_rgba_s3tc_dxt3: case internal_format::compressed_rgba_s3tc_dxt5: return true; + default: + return false; } - - return false; } uint id() const noexcept @@ -1964,6 +1964,8 @@ namespace gl case texture::target::texture1D: glFramebufferTexture1D(GL_FRAMEBUFFER, m_id, GL_TEXTURE_1D, rhs.id(), rhs.level()); break; case texture::target::texture2D: glFramebufferTexture2D(GL_FRAMEBUFFER, m_id, GL_TEXTURE_2D, rhs.id(), rhs.level()); break; case texture::target::texture3D: glFramebufferTexture3D(GL_FRAMEBUFFER, m_id, GL_TEXTURE_3D, rhs.id(), rhs.level(), 0); break; + case texture::target::textureBuffer: + fmt::throw_exception("Tried to assign unsupported texture of type textureBuffer to fbo." HERE); } } @@ -2162,9 +2164,12 @@ namespace gl const GLint length = (GLint)src.length(); { - std::string base_name = "shaderlog/VertexProgram"; + std::string base_name; switch (shader_type) { + case type::vertex: + base_name = "shaderlog/VertexProgram"; + break; case type::fragment: base_name = "shaderlog/FragmentProgram"; break; diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index c664e1dbd9..f68e3d29b5 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -134,6 +134,8 @@ namespace gl case texture::type::uint: size = 4; break; + default: + LOG_ERROR(RSX, "Unsupported texture type"); } switch (fmt_) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 952acf1894..560e75cfb7 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -495,7 +495,7 @@ namespace rsx //Validate put and get registers //TODO: Who should handle graphics exceptions?? const u32 get_address = RSXIOMem.RealAddr(internal_get); - + if (!get_address) { LOG_ERROR(RSX, "Invalid FIFO queue get/put registers found, get=0x%X, put=0x%X", internal_get.load(), put); @@ -1074,9 +1074,9 @@ namespace rsx case rsx::vertex_base_type::s32k: case rsx::vertex_base_type::ub256: return true; + default: + return false; } - - return false; } } @@ -1574,7 +1574,7 @@ namespace rsx GcmTileInfo *tile = find_tile(offset, location); u32 base = 0; - + if (tile) { base = offset - tile->offset; @@ -1587,7 +1587,7 @@ namespace rsx u32 thread::ReadIO32(u32 addr) { u32 value; - + if (!RSXIOMem.Read32(addr, &value)) { fmt::throw_exception("%s(addr=0x%x): RSXIO memory not mapped" HERE, __FUNCTION__, addr);