Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions core/kyty/graphics/host_gpu/renderer/pipeline/shaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,11 @@ static void CreateLayouts(GraphicContext& graphics, PipelineCache::Pipeline& pip
}
const auto max_stage_sampled = *std::ranges::max_element(stage_sampled);
if (sampled_images > limits.maxDescriptorSetSampledImages ||
max_stage_sampled > limits.maxPerStageDescriptorSampledImages ||
sampled_images > DescriptorHeap::MaxSampledImages) {
max_stage_sampled > limits.maxPerStageDescriptorSampledImages) {
EXIT("pipeline needs %" PRIu64 " sampled images (%" PRIu64 " in one stage); the device allows "
"%u per set and %u per stage, a descriptor pool holds %u\n",
"%u per set and %u per stage\n",
sampled_images, max_stage_sampled, limits.maxDescriptorSetSampledImages,
limits.maxPerStageDescriptorSampledImages, DescriptorHeap::MaxSampledImages);
limits.maxPerStageDescriptorSampledImages);
}
pipeline.uses_push_descriptors =
!pipeline.native_bindings && descriptor_count <= graphics.max_push_descriptors;
Expand Down
16 changes: 16 additions & 0 deletions core/libs/prx/libSceAgcDriver/KytyShim/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -928,3 +928,19 @@ set_tests_properties(kyty_shim_hw_oracle PROPERTIES TIMEOUT 60
add_test(NAME kyty_shim_hw_oracle_rows COMMAND kyty_shim_hw_oracle_tests rows)
set_tests_properties(kyty_shim_hw_oracle_rows PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77
PASS_REGULAR_EXPRESSION "kyty_shim_hw_oracle_rows: ok" FAIL_REGULAR_EXPRESSION "terminate called|FAILED")

if(NOT ANYPS5_KYTY_DLL)
add_test_executable(kyty_shim_descriptor_pool_oversize_tests
${CMAKE_CURRENT_SOURCE_DIR}/DescriptorPoolOversize.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../src/Log.cpp)
target_include_directories(kyty_shim_descriptor_pool_oversize_tests PRIVATE ${LIBS_INCLUDE_DIR})
configure_host_test_executable(kyty_shim_descriptor_pool_oversize_tests)
if(MINGW)
target_link_libraries(kyty_shim_descriptor_pool_oversize_tests PRIVATE stdc++ gcc_eh)
endif()
target_link_libraries(kyty_shim_descriptor_pool_oversize_tests PRIVATE
"$<TARGET_GENEX_EVAL:kyty_shim_descriptor_pool_oversize_tests,$<TARGET_PROPERTY:Kyty::gpu,INTERFACE_LINK_LIBRARIES>>"
Kyty::gpu libkernel libc)
add_test(NAME kyty_shim_descriptor_pool_oversize COMMAND kyty_shim_descriptor_pool_oversize_tests)
set_tests_properties(kyty_shim_descriptor_pool_oversize PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77)
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#include "TestVulkanDevice.h"
#include "graphics/host_gpu/renderer/masterSemaphore.h"
#include "graphics/host_gpu/renderer/pipeline/descriptorHeap.h"

#include <array>
#include <cstdint>
#include <cstdio>
#include <cstdlib>

namespace {

bool RequireVulkan() {
const char* value = std::getenv("ANYPS5_REQUIRE_VULKAN");
return value != nullptr && value[0] != '\0' && value[0] != '0';
}

int SkipOrFail(const char* reason) {
std::fprintf(stderr, "kyty_shim_descriptor_pool_oversize: %s\n", reason);
return RequireVulkan() ? 1 : 77;
}

}

int main() {
KytyShimTests::TestVulkanDevice vulkan;
if (const char* reason = vulkan.Initialize(); reason != nullptr) {
return SkipOrFail(reason);
}

const auto& limits = vulkan.graphics.GetPhysicalDeviceProperties().limits;
constexpr uint32_t ExtraSampledImages = 16;
constexpr uint32_t OversizeCount =
Libs::Graphics::DescriptorHeap::MaxSampledImages + ExtraSampledImages;
if (limits.maxDescriptorSetSampledImages < OversizeCount ||
limits.maxPerStageDescriptorSampledImages < OversizeCount) {
std::fprintf(stderr,
"kyty_shim_descriptor_pool_oversize: device sampled image limit (%u / %u) below %u\n",
limits.maxDescriptorSetSampledImages, limits.maxPerStageDescriptorSampledImages,
OversizeCount);
return 77;
}

const std::array bindings {
vk::DescriptorSetLayoutBinding {
.binding = 0,
.descriptorType = vk::DescriptorType::eSampledImage,
.descriptorCount = OversizeCount,
.stageFlags = vk::ShaderStageFlagBits::eCompute,
},
vk::DescriptorSetLayoutBinding {
.binding = 1,
.descriptorType = vk::DescriptorType::eStorageBuffer,
.descriptorCount = 1,
.stageFlags = vk::ShaderStageFlagBits::eCompute,
},
};

const vk::DescriptorSetLayoutCreateInfo layout_info {
.bindingCount = static_cast<uint32_t>(bindings.size()),
.pBindings = bindings.data(),
};
vk::DescriptorSetLayout layout;
if (vulkan.graphics.device.createDescriptorSetLayout(&layout_info, nullptr, &layout) !=
vk::Result::eSuccess) {
std::fprintf(stderr,
"kyty_shim_descriptor_pool_oversize: FAILED createDescriptorSetLayout\n");
return 1;
}

Libs::Graphics::DescriptorHeap::RegisterLayout(layout, bindings);

int status = 0;
{
Libs::Graphics::MasterSemaphore master_semaphore(vulkan.graphics);
Libs::Graphics::DescriptorHeap heap(vulkan.graphics, master_semaphore);

const auto regular_set = heap.Commit(layout);
if (!regular_set) {
std::fprintf(stderr,
"kyty_shim_descriptor_pool_oversize: FAILED Commit returned null set\n");
status = 1;
}

const auto persistent_set = heap.CommitPersistent(layout);
if (!persistent_set) {
std::fprintf(stderr,
"kyty_shim_descriptor_pool_oversize: FAILED CommitPersistent returned null set\n");
status = 1;
}

const vk::SemaphoreSignalInfo signal_info {
.semaphore = master_semaphore.Handle(),
.value = master_semaphore.CurrentTick(),
};
if (vulkan.graphics.device.signalSemaphore(&signal_info) != vk::Result::eSuccess) {
std::fprintf(stderr,
"kyty_shim_descriptor_pool_oversize: FAILED signalSemaphore\n");
status = 1;
}
}

vulkan.graphics.device.destroyDescriptorSetLayout(layout, nullptr);
if (status == 0) {
std::printf("kyty_shim_descriptor_pool_oversize: ok\n");
}
return status;
}
Loading