diff --git a/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp b/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp index dc5ff8640f..7aee3c7d95 100644 --- a/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp +++ b/rpcs3/Emu/RSX/VK/VKFragmentProgram.cpp @@ -57,6 +57,9 @@ void VKFragmentDecompilerThread::prepareBindingTable() vk_prog->binding_table.tex_param_location = location++; vk_prog->binding_table.polygon_stipple_params_location = location++; + std::memset(vk_prog->binding_table.ftex_location, 0xff, sizeof(vk_prog->binding_table.ftex_location)); + std::memset(vk_prog->binding_table.ftex_stencil_location, 0xff, sizeof(vk_prog->binding_table.ftex_stencil_location)); + if (has_textures) [[ likely ]] { unsigned num_textures = 0; diff --git a/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp b/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp index 18d658fc42..9f53e62f2e 100644 --- a/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp +++ b/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp @@ -547,6 +547,8 @@ namespace vk m_descriptor_pool_sizes.clear(); m_descriptor_pool_sizes.reserve(input_type_max_enum); + std::unordered_map descriptor_type_map; + for (const auto& type_arr : m_inputs) { if (type_arr.empty() || type_arr.front().type == input_type_push_constant) @@ -568,16 +570,22 @@ namespace vk }; bindings.push_back(binding); - if (m_descriptor_types.size() < (input.location + 1)) - { - m_descriptor_types.resize((input.location + 1)); - } - - m_descriptor_types[input.location] = type; + descriptor_type_map[input.location] = type; m_descriptor_pool_sizes.back().descriptorCount++; } } + m_descriptor_types.resize(::size32(m_descriptors_dirty)); + + for (u32 i = 0; i < ::size32(m_descriptors_dirty); ++i) + { + if (descriptor_type_map.find(i) == descriptor_type_map.end()) + { + fmt::throw_exception("Invalid input structure. Some input bindings were not declared!"); + } + m_descriptor_types[i] = descriptor_type_map[i]; + } + m_descriptor_set_layout = vk::descriptors::create_layout(bindings); } diff --git a/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp b/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp index a45eb0e2bc..70d0972984 100644 --- a/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp +++ b/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp @@ -38,6 +38,8 @@ void VKVertexDecompilerThread::prepareBindingTable() vk_prog->binding_table.cr_pred_buffer_location = location++; } + std::memset(vk_prog->binding_table.vtex_location, 0xff, sizeof(vk_prog->binding_table.vtex_location)); + for (const ParamType& PT : m_parr.params[PF_PARAM_UNIFORM]) { const bool is_texture_type = PT.type.starts_with("sampler");