Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
kd-11 committed Aug 23, 2022
1 parent 1f9e04f commit 1fc0191
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion rpcs3/Emu/RSX/Common/surface_cache_dma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace rsx

using buffer_object_storage_type = typename Traits::buffer_object_storage_type;
using buffer_object_type = typename Traits::buffer_object_type;
using command_list_type = typename Traits::command_list_type;

struct memory_buffer_entry_t
{
Expand Down Expand Up @@ -48,7 +49,7 @@ namespace rsx
}
}

surface_cache_dma& with_range(Traits::command_list_type cmd, const utils::address_range& range)
surface_cache_dma& with_range(command_list_type cmd, const utils::address_range& range)
{
// Prepare underlying memory so that the range specified is provisioned and contiguous
// 1. Check if we have a pre-existing bo layer
Expand Down
20 changes: 10 additions & 10 deletions rpcs3/Emu/RSX/Common/surface_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,41 +180,41 @@ namespace rsx
virtual bool is_depth_surface() const = 0;
virtual void release_ref(image_storage_type) const = 0;

template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels>
u32 get_surface_width() const
template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels, typename T = u32>
T get_surface_width() const
{
if constexpr (Metrics == rsx::surface_metrics::samples)
{
return surface_width * samples_x;
return static_cast<T>(surface_width * samples_x);
}
else if constexpr (Metrics == rsx::surface_metrics::pixels)
{
return surface_width;
return static_cast<T>(surface_width);
}
else if constexpr (Metrics == rsx::surface_metrics::bytes)
{
return native_pitch;
return static_cast<T>(native_pitch);
}
else
{
fmt::throw_exception("Unreachable");
}
}

template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels>
u32 get_surface_height() const
template<rsx::surface_metrics Metrics = rsx::surface_metrics::pixels, typename T = u32>
T get_surface_height() const
{
if constexpr (Metrics == rsx::surface_metrics::samples)
{
return surface_height * samples_y;
return static_cast<T>(surface_height * samples_y);
}
else if constexpr (Metrics == rsx::surface_metrics::pixels)
{
return surface_height;
return static_cast<T>(surface_height);
}
else if constexpr (Metrics == rsx::surface_metrics::bytes)
{
return surface_height * samples_y;
return static_cast<T>(surface_height * samples_y);
}
else
{
Expand Down
10 changes: 5 additions & 5 deletions rpcs3/Emu/RSX/VK/VKRenderTargets.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ namespace vk
const bool is_scaled = surface->width() != surface->surface_width;
if (is_scaled)
{
const areai src_rect = { 0, 0, source->width(), source->height() };
const areai dst_rect = { 0, 0, surface->get_surface_width<rsx::surface_metrics::samples>(), surface->get_surface_height<rsx::surface_metrics::samples>() };
const areai src_rect = { 0, 0, static_cast<int>(source->width()), static_cast<int>(source->height()) };
const areai dst_rect = { 0, 0, surface->get_surface_width<rsx::surface_metrics::samples, int>(), surface->get_surface_height<rsx::surface_metrics::samples, int>() };

auto scratch = vk::get_typeless_helper(source->format(), source->format_class(), dst_rect.x2, dst_rect.y2);
vk::copy_scaled_image(cmd, source, scratch, src_rect, dst_rect, 1, true, VK_FILTER_NEAREST);
Expand Down Expand Up @@ -540,10 +540,10 @@ namespace vk
}

// Create dst
auto pdev = cmd.get_command_pool().owner;
auto dst = new vk::buffer(*pdev,
auto& dev = cmd.get_command_pool().get_owner();
auto dst = new vk::buffer(dev,
required_bo_size,
pdev->get_memory_mapping().device_local, 0,
dev.get_memory_mapping().device_local, 0,
VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
0, VMM_ALLOCATION_POOL_SURFACE_CACHE);

Expand Down

0 comments on commit 1fc0191

Please sign in to comment.