Skip to content

Commit

Permalink
gpu2: fix descriptor sets count
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Sep 26, 2024
1 parent b53d59a commit e863704
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
30 changes: 17 additions & 13 deletions rpcsx-gpu2/Cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,9 @@ Cache::Image Cache::Tag::getImage(const ImageKey &key, Access access) {
key.pitch, key.baseArrayLayer, key.arrayLayerCount, key.baseMipLevel,
key.mipCount, key.pow2pad);

VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_SAMPLED_BIT // | VK_IMAGE_USAGE_STORAGE_BIT
VkImageUsageFlags usage =
VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_SAMPLED_BIT // | VK_IMAGE_USAGE_STORAGE_BIT
;

bool isCompressed =
Expand Down Expand Up @@ -1009,29 +1009,31 @@ Cache::createGraphicsDescriptorSets() {
return result;
}

constexpr auto maxSets = Cache::kGraphicsStages.size() * 128;

if (mGraphicsDescriptorPool == nullptr) {
VkDescriptorPoolSize poolSizes[]{
{
.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.descriptorCount = 1,
.descriptorCount = 1 * (maxSets / 4),
},
{
.type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
.descriptorCount = 16 * 3,
.descriptorCount = 16 * (maxSets / 4),
},
{
.type = VK_DESCRIPTOR_TYPE_SAMPLER,
.descriptorCount = 16,
.descriptorCount = 16 * (maxSets / 4),
},
{
.type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
.descriptorCount = 16,
.descriptorCount = 16 * (maxSets / 4),
},
};

VkDescriptorPoolCreateInfo info{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.maxSets = Cache::kGraphicsStages.size() * 100,
.maxSets = maxSets,
.poolSizeCount = static_cast<uint32_t>(std::size(poolSizes)),
.pPoolSizes = poolSizes,
};
Expand Down Expand Up @@ -1064,29 +1066,31 @@ VkDescriptorSet Cache::createComputeDescriptorSet() {
return result;
}

constexpr auto maxSets = 128;

if (mComputeDescriptorPool == nullptr) {
VkDescriptorPoolSize poolSizes[]{
{
.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.descriptorCount = 1,
.descriptorCount = 1 * (maxSets / 4),
},
{
.type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
.descriptorCount = 16 * 3,
.descriptorCount = 16 * (maxSets / 4),
},
{
.type = VK_DESCRIPTOR_TYPE_SAMPLER,
.descriptorCount = 16,
.descriptorCount = 16 * (maxSets / 4),
},
{
.type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
.descriptorCount = 16,
.descriptorCount = 16 * (maxSets / 4),
},
};

VkDescriptorPoolCreateInfo info{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.maxSets = 8,
.maxSets = maxSets,
.poolSizeCount = static_cast<uint32_t>(std::size(poolSizes)),
.pPoolSizes = poolSizes,
};
Expand Down
3 changes: 0 additions & 3 deletions rpcsx-gpu2/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,6 @@ void amdgpu::draw(GraphicsPipe &pipe, int vmId, std::uint32_t firstVertex,
.supportsBarycentric = vk::context->supportsBarycentric,
.supportsInt8 = vk::context->supportsInt8,
.supportsInt64Atomics = vk::context->supportsInt64Atomics,
// .supportsBarycentric = false,
// .supportsInt8 = false,
// .supportsInt64Atomics = false,
};

auto shader = cacheTag.getShader({
Expand Down
6 changes: 3 additions & 3 deletions rpcsx-gpu2/lib/amdgpu-tiler/src/tiler_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct TilerShader {
struct amdgpu::GpuTiler::Impl {
TilerDecriptorSetLayout descriptorSetLayout;
std::mutex descriptorMtx;
VkDescriptorSet descriptorSets[4]{};
VkDescriptorSet descriptorSets[32]{};
VkDescriptorPool descriptorPool;
std::uint32_t inUseDescriptorSets = 0;

Expand Down Expand Up @@ -119,12 +119,12 @@ struct amdgpu::GpuTiler::Impl {
{
VkDescriptorPoolSize poolSizes[]{{
.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.descriptorCount = 1,
.descriptorCount = static_cast<std::uint32_t>(std::size(descriptorSets)) * 2,
}};

VkDescriptorPoolCreateInfo info{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.maxSets = static_cast<std::uint32_t>(std::size(descriptorSets)) * 4,
.maxSets = static_cast<std::uint32_t>(std::size(descriptorSets)) * 2,
.poolSizeCount = static_cast<uint32_t>(std::size(poolSizes)),
.pPoolSizes = poolSizes,
};
Expand Down

0 comments on commit e863704

Please sign in to comment.