diff --git a/rpcs3/Emu/RSX/Common/surface_utils.h b/rpcs3/Emu/RSX/Common/surface_utils.h index 864e0acaf8..9990f8cf7a 100644 --- a/rpcs3/Emu/RSX/Common/surface_utils.h +++ b/rpcs3/Emu/RSX/Common/surface_utils.h @@ -94,12 +94,12 @@ namespace rsx auto src = static_cast(source); std::tie(src_w, src_h) = rsx::apply_resolution_scale(src_w, src_h, - src->get_surface_width(), - src->get_surface_height()); + src->template get_surface_width(), + src->template get_surface_height()); std::tie(dst_w, dst_h) = rsx::apply_resolution_scale(dst_w, dst_h, - target_surface->get_surface_width()), - target_surface->get_surface_height())); + target_surface->template get_surface_width(), + target_surface->template get_surface_height()); } width = src_w; @@ -181,27 +181,42 @@ namespace rsx template u32 get_surface_width() const { - switch constexpr (Metrics) + if constexpr (Metrics == rsx::surface_metrics::samples) { - case rsx::surface_metrics::samples: - return surface_width * samples_x; - case rsx::surface_metrics::pixels: - return surface_width; - case rsx::surface_metrics::bytes: - return native_pitch; + return surface_width * samples_x; + } + else if constexpr (Metrics == rsx::surface_metrics::pixels) + { + return surface_width; + } + else if constexpr (Metrics == rsx::surface_metrics::bytes) + { + return native_pitch; + } + else + { + static_assert(false); } } template u32 get_surface_height() const { - switch constexpr (Metrics) + if constexpr (Metrics == rsx::surface_metrics::samples) { - case rsx::surface_metrics::samples: - case rsx::surface_metrics::bytes: - return surface_height * samples_y; - case rsx::surface_metrics::pixels: - return surface_height; + return surface_height * samples_y; + } + else if constexpr (Metrics == rsx::surface_metrics::pixels) + { + return surface_height; + } + else if constexpr (Metrics == rsx::surface_metrics::bytes) + { + return surface_height * samples_y; + } + else + { + static_assert(false); } } @@ -614,7 +629,7 @@ namespace rsx inline rsx::address_range get_memory_range() const { - const u32 internal_height = get_surface_height()); + const u32 internal_height = get_surface_height(); const u32 excess = (rsx_pitch - native_pitch); return rsx::address_range::start_length(base_addr, internal_height * rsx_pitch - excess); } diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 7957f6c7cd..0316f0cd50 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -1952,7 +1952,7 @@ namespace rsx u32 coverage_size = 0; for (const auto& section : overlapping_fbos) { - const auto area = section.surface->get_native_pitch() * section.surface->get_surface_height(); + const auto area = section.surface->get_native_pitch() * section.surface->template get_surface_height(); coverage_size += area; } @@ -2509,8 +2509,8 @@ namespace rsx typeless_info.src_gcm_format = helpers::get_sized_blit_format(src_is_argb8, false, is_format_convert); } - if (surf->get_surface_width() != surf->width() || - surf->get_surface_height() != surf->height()) + if (surf->template get_surface_width() != surf->width() || + surf->template get_surface_height() != surf->height()) { // Must go through a scaling operation due to resolution scaling being present ensure(g_cfg.video.resolution_scale_percent != 100); @@ -2606,8 +2606,8 @@ namespace rsx size2u src_dimensions = { 0, 0 }; if (src_is_render_target) { - src_dimensions.width = src_subres.surface->get_surface_width(); - src_dimensions.height = src_subres.surface->get_surface_height(); + src_dimensions.width = src_subres.surface->template get_surface_width(); + src_dimensions.height = src_subres.surface->template get_surface_height(); } const auto props = texture_cache_helpers::get_optimal_blit_target_properties( @@ -2761,8 +2761,8 @@ namespace rsx typeless_info.dst_context = texture_upload_context::framebuffer_storage; dst_is_depth_surface = typeless_info.dst_is_typeless ? false : dst_subres.is_depth; - max_dst_width = static_cast(dst_subres.surface->get_surface_width() * typeless_info.dst_scaling_hint); - max_dst_height = dst_subres.surface->get_surface_height(); + max_dst_width = static_cast(dst_subres.surface->template get_surface_width() * typeless_info.dst_scaling_hint); + max_dst_height = dst_subres.surface->template get_surface_height(); } // Create source texture if does not exist @@ -3109,8 +3109,8 @@ namespace rsx if (src_is_render_target) { - const auto surface_width = src_subres.surface->get_surface_width(); - const auto surface_height = src_subres.surface->get_surface_height(); + const auto surface_width = src_subres.surface->template get_surface_width(); + const auto surface_height = src_subres.surface->template get_surface_height(); std::tie(src_area.x1, src_area.y1) = rsx::apply_resolution_scale(src_area.x1, src_area.y1, surface_width, surface_height); std::tie(src_area.x2, src_area.y2) = rsx::apply_resolution_scale(src_area.x2, src_area.y2, surface_width, surface_height); @@ -3120,8 +3120,8 @@ namespace rsx if (dst_is_render_target) { - const auto surface_width = dst_subres.surface->get_surface_width(); - const auto surface_height = dst_subres.surface->get_surface_height(); + const auto surface_width = dst_subres.surface->template get_surface_width(); + const auto surface_height = dst_subres.surface->template get_surface_height(); std::tie(dst_area.x1, dst_area.y1) = rsx::apply_resolution_scale(dst_area.x1, dst_area.y1, surface_width, surface_height); std::tie(dst_area.x2, dst_area.y2) = rsx::apply_resolution_scale(dst_area.x2, dst_area.y2, surface_width, surface_height); diff --git a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h index 57217c0e10..feadec3786 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache_helpers.h +++ b/rpcs3/Emu/RSX/Common/texture_cache_helpers.h @@ -303,8 +303,8 @@ namespace rsx const auto h = std::min(section_end, slice_end) - dst_y; dst_y = (dst_y - slice_begin); - const auto surface_width = section.surface->get_surface_width(); - const auto surface_height = section.surface->get_surface_height(); + const auto surface_width = section.surface->template get_surface_width(); + const auto surface_height = section.surface->template get_surface_height(); const auto [src_width, src_height] = rsx::apply_resolution_scale(section.src_area.width, h, surface_width, surface_height); const auto [dst_width, dst_height] = rsx::apply_resolution_scale(section.dst_area.width, h, attr.width, attr.height); @@ -477,8 +477,8 @@ namespace rsx return false; } - const auto surface_width = texptr->get_surface_width(); - const auto surface_height = texptr->get_surface_height(); + const auto surface_width = texptr->template get_surface_width(); + const auto surface_height = texptr->template get_surface_height(); switch (extended_dimension) { @@ -507,8 +507,8 @@ namespace rsx { texptr->read_barrier(cmd); - const auto surface_width = texptr->get_surface_width(); - const auto surface_height = texptr->get_surface_height(); + const auto surface_width = texptr->template get_surface_width(); + const auto surface_height = texptr->template get_surface_height(); bool is_depth = texptr->is_depth_surface(); auto attr2 = attr;