Skip to content

Commit

Permalink
Merge branch 'shadps4-emu:main' into Full-Blood
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolix29 authored Sep 27, 2024
2 parents 02ce038 + ebebafe commit fed033b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
3 changes: 2 additions & 1 deletion src/core/address_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ struct AddressSpace::Impl {
}
reduction += ReductionOnFail;
}
ASSERT_MSG(virtual_base, "Unable to reserve virtual address space!");
ASSERT_MSG(virtual_base, "Unable to reserve virtual address space: {}",
Common::GetLastErrorMsg());

// Take the reduction off of the system managed area, and leave the others unchanged.
system_managed_base = virtual_base;
Expand Down
3 changes: 2 additions & 1 deletion src/video_core/renderer_vulkan/liverpool_to_vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,13 @@ static constexpr vk::FormatFeatureFlags2 GetNumberFormatFeatureFlags(
case AmdGpu::NumberFormat::Uint:
case AmdGpu::NumberFormat::Sint:
case AmdGpu::NumberFormat::Float:
return BufferRead | BufferWrite | ImageRead | ImageWrite;
return BufferRead | BufferWrite | ImageRead | ImageWrite | Mrt;
case AmdGpu::NumberFormat::Uscaled:
case AmdGpu::NumberFormat::Sscaled:
case AmdGpu::NumberFormat::SnormNz:
return BufferRead | ImageRead;
case AmdGpu::NumberFormat::Srgb:
return ImageRead | Mrt;
case AmdGpu::NumberFormat::Ubnorm:
case AmdGpu::NumberFormat::UbnromNz:
case AmdGpu::NumberFormat::Ubint:
Expand Down
63 changes: 32 additions & 31 deletions src/video_core/texture_cache/tile_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,38 @@ TileManager::TileManager(const Vulkan::Instance& instance, Vulkan::Scheduler& sc
HostShaders::DETILE_M32X4_COMP,
};

boost::container::static_vector<vk::DescriptorSetLayoutBinding, 2> bindings{
{
.binding = 0,
.descriptorType = vk::DescriptorType::eStorageBuffer,
.descriptorCount = 1,
.stageFlags = vk::ShaderStageFlagBits::eCompute,
},
{
.binding = 1,
.descriptorType = vk::DescriptorType::eStorageBuffer,
.descriptorCount = 1,
.stageFlags = vk::ShaderStageFlagBits::eCompute,
},
};

const vk::DescriptorSetLayoutCreateInfo desc_layout_ci = {
.flags = vk::DescriptorSetLayoutCreateFlagBits::ePushDescriptorKHR,
.bindingCount = static_cast<u32>(bindings.size()),
.pBindings = bindings.data(),
};
auto desc_layout_result = instance.GetDevice().createDescriptorSetLayoutUnique(desc_layout_ci);
ASSERT_MSG(desc_layout_result.result == vk::Result::eSuccess,
"Failed to create descriptor set layout: {}",
vk::to_string(desc_layout_result.result));
desc_layout = std::move(desc_layout_result.value);

const vk::PushConstantRange push_constants = {
.stageFlags = vk::ShaderStageFlagBits::eCompute,
.offset = 0,
.size = sizeof(DetilerParams),
};

for (int pl_id = 0; pl_id < DetilerType::Max; ++pl_id) {
auto& ctx = detilers[pl_id];

Expand All @@ -275,37 +307,6 @@ TileManager::TileManager(const Vulkan::Instance& instance, Vulkan::Scheduler& sc
.pName = "main",
};

boost::container::static_vector<vk::DescriptorSetLayoutBinding, 2> bindings{
{
.binding = 0,
.descriptorType = vk::DescriptorType::eStorageBuffer,
.descriptorCount = 1,
.stageFlags = vk::ShaderStageFlagBits::eCompute,
},
{
.binding = 1,
.descriptorType = vk::DescriptorType::eStorageBuffer,
.descriptorCount = 1,
.stageFlags = vk::ShaderStageFlagBits::eCompute,
},
};

const vk::DescriptorSetLayoutCreateInfo desc_layout_ci = {
.flags = vk::DescriptorSetLayoutCreateFlagBits::ePushDescriptorKHR,
.bindingCount = static_cast<u32>(bindings.size()),
.pBindings = bindings.data(),
};
auto [desc_layout_result, desc_layout] =
instance.GetDevice().createDescriptorSetLayoutUnique(desc_layout_ci);
ASSERT_MSG(desc_layout_result == vk::Result::eSuccess,
"Failed to create descriptor set layout: {}", vk::to_string(desc_layout_result));

const vk::PushConstantRange push_constants = {
.stageFlags = vk::ShaderStageFlagBits::eCompute,
.offset = 0,
.size = sizeof(DetilerParams),
};

const vk::DescriptorSetLayout set_layout = *desc_layout;
const vk::PipelineLayoutCreateInfo layout_info = {
.setLayoutCount = 1U,
Expand Down
1 change: 1 addition & 0 deletions src/video_core/texture_cache/tile_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class TileManager {
private:
const Vulkan::Instance& instance;
Vulkan::Scheduler& scheduler;
vk::UniqueDescriptorSetLayout desc_layout;
std::array<DetilerContext, DetilerType::Max> detilers;
};

Expand Down

0 comments on commit fed033b

Please sign in to comment.