rsx: Fix build

This commit is contained in:
kd-11 2022-03-05 18:59:21 +03:00 committed by kd-11
parent 0df903090d
commit 8d3d290e33
3 changed files with 50 additions and 35 deletions

View File

@ -94,12 +94,12 @@ namespace rsx
auto src = static_cast<T>(source); auto src = static_cast<T>(source);
std::tie(src_w, src_h) = rsx::apply_resolution_scale<true>(src_w, src_h, std::tie(src_w, src_h) = rsx::apply_resolution_scale<true>(src_w, src_h,
src->get_surface_width<rsx::surface_metrics::pixels>(), src->template get_surface_width<rsx::surface_metrics::pixels>(),
src->get_surface_height<rsx::surface_metrics::pixels>()); src->template get_surface_height<rsx::surface_metrics::pixels>());
std::tie(dst_w, dst_h) = rsx::apply_resolution_scale<true>(dst_w, dst_h, std::tie(dst_w, dst_h) = rsx::apply_resolution_scale<true>(dst_w, dst_h,
target_surface->get_surface_width<rsx::surface_metrics::pixels>()), target_surface->template get_surface_width<rsx::surface_metrics::pixels>(),
target_surface->get_surface_height<rsx::surface_metrics::pixels>())); target_surface->template get_surface_height<rsx::surface_metrics::pixels>());
} }
width = src_w; width = src_w;
@ -181,28 +181,43 @@ namespace rsx
template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels> template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels>
u32 get_surface_width() const 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; return surface_width * samples_x;
case rsx::surface_metrics::pixels: }
else if constexpr (Metrics == rsx::surface_metrics::pixels)
{
return surface_width; return surface_width;
case rsx::surface_metrics::bytes: }
else if constexpr (Metrics == rsx::surface_metrics::bytes)
{
return native_pitch; return native_pitch;
} }
else
{
static_assert(false);
}
} }
template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels> template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels>
u32 get_surface_height() const 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; return surface_height * samples_y;
case rsx::surface_metrics::pixels: }
else if constexpr (Metrics == rsx::surface_metrics::pixels)
{
return surface_height; return surface_height;
} }
else if constexpr (Metrics == rsx::surface_metrics::bytes)
{
return surface_height * samples_y;
}
else
{
static_assert(false);
}
} }
inline u32 get_rsx_pitch() const inline u32 get_rsx_pitch() const
@ -614,7 +629,7 @@ namespace rsx
inline rsx::address_range get_memory_range() const inline rsx::address_range get_memory_range() const
{ {
const u32 internal_height = get_surface_height<rsx::surface_metrics::samples>()); const u32 internal_height = get_surface_height<rsx::surface_metrics::samples>();
const u32 excess = (rsx_pitch - native_pitch); const u32 excess = (rsx_pitch - native_pitch);
return rsx::address_range::start_length(base_addr, internal_height * rsx_pitch - excess); return rsx::address_range::start_length(base_addr, internal_height * rsx_pitch - excess);
} }

View File

@ -1952,7 +1952,7 @@ namespace rsx
u32 coverage_size = 0; u32 coverage_size = 0;
for (const auto& section : overlapping_fbos) for (const auto& section : overlapping_fbos)
{ {
const auto area = section.surface->get_native_pitch() * section.surface->get_surface_height<rsx::surface_metrics::bytes>(); const auto area = section.surface->get_native_pitch() * section.surface->template get_surface_height<rsx::surface_metrics::bytes>();
coverage_size += area; 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); typeless_info.src_gcm_format = helpers::get_sized_blit_format(src_is_argb8, false, is_format_convert);
} }
if (surf->get_surface_width<rsx::surface_metrics::pixels>() != surf->width() || if (surf->template get_surface_width<rsx::surface_metrics::pixels>() != surf->width() ||
surf->get_surface_height<rsx::surface_metrics::pixels>() != surf->height()) surf->template get_surface_height<rsx::surface_metrics::pixels>() != surf->height())
{ {
// Must go through a scaling operation due to resolution scaling being present // Must go through a scaling operation due to resolution scaling being present
ensure(g_cfg.video.resolution_scale_percent != 100); ensure(g_cfg.video.resolution_scale_percent != 100);
@ -2606,8 +2606,8 @@ namespace rsx
size2u src_dimensions = { 0, 0 }; size2u src_dimensions = { 0, 0 };
if (src_is_render_target) if (src_is_render_target)
{ {
src_dimensions.width = src_subres.surface->get_surface_width<rsx::surface_metrics::samples>(); src_dimensions.width = src_subres.surface->template get_surface_width<rsx::surface_metrics::samples>();
src_dimensions.height = src_subres.surface->get_surface_height<rsx::surface_metrics::samples>(); src_dimensions.height = src_subres.surface->template get_surface_height<rsx::surface_metrics::samples>();
} }
const auto props = texture_cache_helpers::get_optimal_blit_target_properties( 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; typeless_info.dst_context = texture_upload_context::framebuffer_storage;
dst_is_depth_surface = typeless_info.dst_is_typeless ? false : dst_subres.is_depth; dst_is_depth_surface = typeless_info.dst_is_typeless ? false : dst_subres.is_depth;
max_dst_width = static_cast<u16>(dst_subres.surface->get_surface_width<rsx::surface_metrics::samples>() * typeless_info.dst_scaling_hint); max_dst_width = static_cast<u16>(dst_subres.surface->template get_surface_width<rsx::surface_metrics::samples>() * typeless_info.dst_scaling_hint);
max_dst_height = dst_subres.surface->get_surface_height<rsx::surface_metrics::samples>(); max_dst_height = dst_subres.surface->template get_surface_height<rsx::surface_metrics::samples>();
} }
// Create source texture if does not exist // Create source texture if does not exist
@ -3109,8 +3109,8 @@ namespace rsx
if (src_is_render_target) if (src_is_render_target)
{ {
const auto surface_width = src_subres.surface->get_surface_width<rsx::surface_metrics::pixels>(); const auto surface_width = src_subres.surface->template get_surface_width<rsx::surface_metrics::pixels>();
const auto surface_height = src_subres.surface->get_surface_height<rsx::surface_metrics::pixels>(); const auto surface_height = src_subres.surface->template get_surface_height<rsx::surface_metrics::pixels>();
std::tie(src_area.x1, src_area.y1) = rsx::apply_resolution_scale<false>(src_area.x1, src_area.y1, surface_width, surface_height); std::tie(src_area.x1, src_area.y1) = rsx::apply_resolution_scale<false>(src_area.x1, src_area.y1, surface_width, surface_height);
std::tie(src_area.x2, src_area.y2) = rsx::apply_resolution_scale<true>(src_area.x2, src_area.y2, surface_width, surface_height); std::tie(src_area.x2, src_area.y2) = rsx::apply_resolution_scale<true>(src_area.x2, src_area.y2, surface_width, surface_height);
@ -3120,8 +3120,8 @@ namespace rsx
if (dst_is_render_target) if (dst_is_render_target)
{ {
const auto surface_width = dst_subres.surface->get_surface_width<rsx::surface_metrics::pixels>(); const auto surface_width = dst_subres.surface->template get_surface_width<rsx::surface_metrics::pixels>();
const auto surface_height = dst_subres.surface->get_surface_height<rsx::surface_metrics::pixels>(); const auto surface_height = dst_subres.surface->template get_surface_height<rsx::surface_metrics::pixels>();
std::tie(dst_area.x1, dst_area.y1) = rsx::apply_resolution_scale<false>(dst_area.x1, dst_area.y1, surface_width, surface_height); std::tie(dst_area.x1, dst_area.y1) = rsx::apply_resolution_scale<false>(dst_area.x1, dst_area.y1, surface_width, surface_height);
std::tie(dst_area.x2, dst_area.y2) = rsx::apply_resolution_scale<true>(dst_area.x2, dst_area.y2, surface_width, surface_height); std::tie(dst_area.x2, dst_area.y2) = rsx::apply_resolution_scale<true>(dst_area.x2, dst_area.y2, surface_width, surface_height);

View File

@ -303,8 +303,8 @@ namespace rsx
const auto h = std::min(section_end, slice_end) - dst_y; const auto h = std::min(section_end, slice_end) - dst_y;
dst_y = (dst_y - slice_begin); dst_y = (dst_y - slice_begin);
const auto surface_width = section.surface->get_surface_width<rsx::surface_metrics::pixels>(); const auto surface_width = section.surface->template get_surface_width<rsx::surface_metrics::pixels>();
const auto surface_height = section.surface->get_surface_height<rsx::surface_metrics::pixels>(); const auto surface_height = section.surface->template get_surface_height<rsx::surface_metrics::pixels>();
const auto [src_width, src_height] = rsx::apply_resolution_scale<true>(section.src_area.width, h, surface_width, surface_height); const auto [src_width, src_height] = rsx::apply_resolution_scale<true>(section.src_area.width, h, surface_width, surface_height);
const auto [dst_width, dst_height] = rsx::apply_resolution_scale<true>(section.dst_area.width, h, attr.width, attr.height); const auto [dst_width, dst_height] = rsx::apply_resolution_scale<true>(section.dst_area.width, h, attr.width, attr.height);
@ -477,8 +477,8 @@ namespace rsx
return false; return false;
} }
const auto surface_width = texptr->get_surface_width<rsx::surface_metrics::samples>(); const auto surface_width = texptr->template get_surface_width<rsx::surface_metrics::samples>();
const auto surface_height = texptr->get_surface_height<rsx::surface_metrics::samples>(); const auto surface_height = texptr->template get_surface_height<rsx::surface_metrics::samples>();
switch (extended_dimension) switch (extended_dimension)
{ {
@ -507,8 +507,8 @@ namespace rsx
{ {
texptr->read_barrier(cmd); texptr->read_barrier(cmd);
const auto surface_width = texptr->get_surface_width<rsx::surface_metrics::samples>(); const auto surface_width = texptr->template get_surface_width<rsx::surface_metrics::samples>();
const auto surface_height = texptr->get_surface_height<rsx::surface_metrics::samples>(); const auto surface_height = texptr->template get_surface_height<rsx::surface_metrics::samples>();
bool is_depth = texptr->is_depth_surface(); bool is_depth = texptr->is_depth_surface();
auto attr2 = attr; auto attr2 = attr;