diff --git a/src/common/binary_reader_writer.h b/src/common/binary_reader_writer.h index 7242765b2..ec83d92bf 100644 --- a/src/common/binary_reader_writer.h +++ b/src/common/binary_reader_writer.h @@ -272,7 +272,7 @@ public: ALWAYS_INLINE BinaryFileReader& operator>>(s64& val) { val = ReadT(); return *this; } ALWAYS_INLINE BinaryFileReader& operator>>(u64& val) { val = ReadT(); return *this; } ALWAYS_INLINE BinaryFileReader& operator>>(float& val) { val = ReadT(); return *this; } - ALWAYS_INLINE BinaryFileReader& operator>>(std::string_view& val) { val = ReadCString(); return *this; } + ALWAYS_INLINE BinaryFileReader& operator>>(std::string& val) { val = ReadCString(); return *this; } // clang-format on template diff --git a/src/common/heap_array.h b/src/common/heap_array.h index 7e844a541..fa9935661 100644 --- a/src/common/heap_array.h +++ b/src/common/heap_array.h @@ -223,7 +223,7 @@ public: } } - DynamicHeapArray(this_type&& move) + DynamicHeapArray(this_type&& move) noexcept { m_data = move.m_data; m_size = move.m_size; @@ -358,7 +358,7 @@ public: return *this; } - this_type& operator=(this_type&& move) + this_type& operator=(this_type&& move) noexcept { assign(std::move(move)); return *this; diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 3fd9dea62..59cf34a95 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -737,13 +737,14 @@ std::optional StringUtil::BytePatternSearch(const std::span by return std::nullopt; const bool allocate_on_heap = (pattern_length >= 512); - u8* match_bytes = allocate_on_heap ? static_cast(alloca(pattern_length * 2)) : new u8[pattern_length * 2]; + u8* match_bytes = allocate_on_heap ? new u8[pattern_length * 2] : static_cast(alloca(pattern_length * 2)); u8* match_masks = match_bytes + pattern_length; hinibble = true; u8 match_byte = 0; u8 match_mask = 0; - for (size_t i = 0, match_len = 0; i < pattern.size(); i++) + size_t match_len = 0; + for (size_t i = 0; i < pattern.size(); i++) { u8 nibble = 0, nibble_mask = 0xF; if (pattern[i] >= '0' && pattern[i] <= '9') @@ -772,8 +773,8 @@ std::optional StringUtil::BytePatternSearch(const std::span by match_mask = nibble_mask; } } - if (pattern_length == 0) - return std::nullopt; + + DebugAssert(match_len == pattern_length); std::optional ret; const size_t max_search_offset = bytes.size() - pattern_length; diff --git a/src/core/achievements.cpp b/src/core/achievements.cpp index 8f0e067f4..386a150ce 100644 --- a/src/core/achievements.cpp +++ b/src/core/achievements.cpp @@ -2884,7 +2884,7 @@ void Achievements::DrawAchievementsWindow() progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) - (text_size.y / 2.0f)); dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos, ImGui::GetColorU32(UIStyle.PrimaryTextColor), text.c_str(), text.end_ptr()); - top += progress_height + spacing; + // top += progress_height + spacing; } } } diff --git a/src/core/analog_controller.h b/src/core/analog_controller.h index 2611d7ca7..d3d2a2c4b 100644 --- a/src/core/analog_controller.h +++ b/src/core/analog_controller.h @@ -109,8 +109,8 @@ private: // Transmit and receive buffers, not including the first Hi-Z/ack response byte static constexpr u32 MAX_RESPONSE_LENGTH = 8; - std::array m_rx_buffer; - std::array m_tx_buffer; + std::array m_rx_buffer{}; + std::array m_tx_buffer{}; // Get number of response halfwords (excluding the initial controller info halfword) u8 GetResponseNumHalfwords() const; diff --git a/src/core/cdrom.cpp b/src/core/cdrom.cpp index 1a0b396bd..2ea6b3ffd 100644 --- a/src/core/cdrom.cpp +++ b/src/core/cdrom.cpp @@ -465,7 +465,7 @@ struct CDROMState XorShift128PlusPlus prng; - std::array sector_buffers; + std::array sector_buffers = {}; u32 current_read_sector_buffer = 0; u32 current_write_sector_buffer = 0; @@ -927,7 +927,7 @@ bool CDROM::CanReadMedia() return (s_state.drive_state != DriveState::ShellOpening && s_reader.HasMedia()); } -bool CDROM::InsertMedia(std::unique_ptr media, DiscRegion region, std::string_view serial, +bool CDROM::InsertMedia(std::unique_ptr& media, DiscRegion region, std::string_view serial, std::string_view title, Error* error) { // Load SBI/LSD first. diff --git a/src/core/cdrom.h b/src/core/cdrom.h index 04e8854e3..23d83a02e 100644 --- a/src/core/cdrom.h +++ b/src/core/cdrom.h @@ -30,7 +30,7 @@ bool IsMediaPS1Disc(); bool IsMediaAudioCD(); bool DoesMediaRegionMatchConsole(); -bool InsertMedia(std::unique_ptr media, DiscRegion region, std::string_view serial, std::string_view title, +bool InsertMedia(std::unique_ptr& media, DiscRegion region, std::string_view serial, std::string_view title, Error* error); std::unique_ptr RemoveMedia(bool for_disc_swap); bool PrecacheMedia(); diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index 6ce42eb54..d050d64e8 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -409,12 +409,10 @@ void ImGuiManager::DrawPerformanceOverlay(const GPUBackend* gpu, float& position if (CPU::g_state.using_interpreter) { text.append_format("{}{}", first ? "" : "/", "I"); - first = false; } else if (g_settings.cpu_execution_mode == CPUExecutionMode::CachedInterpreter) { text.append_format("{}{}", first ? "" : "/", "CI"); - first = false; } else { @@ -424,10 +422,7 @@ void ImGuiManager::DrawPerformanceOverlay(const GPUBackend* gpu, float& position first = false; } if (g_settings.cpu_recompiler_memory_exceptions) - { text.append_format("{}{}", first ? "" : "/", "ME"); - first = false; - } } text.append("]: "); diff --git a/src/core/mdec.cpp b/src/core/mdec.cpp index f5a54f060..5e1e0ece3 100644 --- a/src/core/mdec.cpp +++ b/src/core/mdec.cpp @@ -276,11 +276,7 @@ void MDEC::DMARead(u32* words, u32 word_count) const u32 words_to_read = std::min(word_count, s_state.data_out_fifo.GetSize()); if (words_to_read > 0) - { s_state.data_out_fifo.PopRange(words, words_to_read); - words += words_to_read; - word_count -= words_to_read; - } DEBUG_LOG("DMA read complete, {} bytes left", s_state.data_out_fifo.GetSize() * sizeof(u32)); if (s_state.data_out_fifo.IsEmpty()) diff --git a/src/core/system.cpp b/src/core/system.cpp index ed9528156..549cb67fc 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1901,8 +1901,7 @@ bool System::Initialize(std::unique_ptr disc, DiscRegion disc_region, b return false; // CDROM before GPU, that way we don't modeswitch. - if (disc && - !CDROM::InsertMedia(std::move(disc), disc_region, s_state.running_game_serial, s_state.running_game_title, error)) + if (disc && !CDROM::InsertMedia(disc, disc_region, s_state.running_game_serial, s_state.running_game_title, error)) return false; // TODO: Drop class @@ -2921,8 +2920,8 @@ bool System::LoadStateFromBuffer(const SaveStateBuffer& buffer, Error* error, bo (media_subimage_index != 0 && new_disc->HasSubImages() && !new_disc->SwitchSubImage(media_subimage_index, error ? error : &local_error)) || (UpdateRunningGame(buffer.media_path, new_disc.get(), false), - !CDROM::InsertMedia(std::move(new_disc), new_disc_region, s_state.running_game_serial, - s_state.running_game_title, error ? error : &local_error))) + !CDROM::InsertMedia(new_disc, new_disc_region, s_state.running_game_serial, s_state.running_game_title, + error ? error : &local_error))) { if (CDROM::HasMedia()) { @@ -4070,9 +4069,8 @@ bool System::InsertMedia(const char* path) std::unique_ptr image = CDImage::Open(path, g_settings.cdrom_load_image_patches, &error); const DiscRegion region = image ? GameList::GetCustomRegionForPath(path).value_or(GetRegionForImage(image.get())) : DiscRegion::NonPS1; - if (!image || - (UpdateRunningGame(path, image.get(), false), - !CDROM::InsertMedia(std::move(image), region, s_state.running_game_serial, s_state.running_game_title, &error))) + if (!image || (UpdateRunningGame(path, image.get(), false), + !CDROM::InsertMedia(image, region, s_state.running_game_serial, s_state.running_game_title, &error))) { Host::AddIconOSDWarning( "DiscInserted", ICON_FA_COMPACT_DISC, @@ -4327,8 +4325,7 @@ bool System::SwitchMediaSubImage(u32 index) subimage_title = image->GetSubImageMetadata(index, "title"); title = image->GetMetadata("title"); UpdateRunningGame(image->GetPath(), image.get(), false); - okay = - CDROM::InsertMedia(std::move(image), region, s_state.running_game_serial, s_state.running_game_title, &error); + okay = CDROM::InsertMedia(image, region, s_state.running_game_serial, s_state.running_game_title, &error); } if (!okay) { @@ -4342,7 +4339,7 @@ bool System::SwitchMediaSubImage(u32 index) const DiscRegion region = GameList::GetCustomRegionForPath(image->GetPath()).value_or(GetRegionForImage(image.get())); UpdateRunningGame(image->GetPath(), image.get(), false); - CDROM::InsertMedia(std::move(image), region, s_state.running_game_serial, s_state.running_game_title, nullptr); + CDROM::InsertMedia(image, region, s_state.running_game_serial, s_state.running_game_title, nullptr); return false; } @@ -4783,7 +4780,8 @@ void System::WarnAboutUnsafeSettings() if (g_settings.cdrom_read_speedup != 1 || g_settings.cdrom_seek_speedup != 1) append(ICON_EMOJI_WARNING, TRANSLATE_SV("System", "CD-ROM read/seek speedup is enabled. This may crash games.")); if (g_settings.gpu_force_video_timing != ForceVideoTimingMode::Disabled) - append(ICON_FA_TV, TRANSLATE_SV("System", "Frame rate is not set to automatic. Games may run at incorrect speeds.")); + append(ICON_FA_TV, + TRANSLATE_SV("System", "Frame rate is not set to automatic. Games may run at incorrect speeds.")); if (!g_settings.IsUsingSoftwareRenderer()) { if (g_settings.gpu_multisamples != 1) diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp index 82622abb6..2dbab058b 100644 --- a/src/duckstation-qt/audiosettingswidget.cpp +++ b/src/duckstation-qt/audiosettingswidget.cpp @@ -138,7 +138,7 @@ AudioBackend AudioSettingsWidget::getEffectiveBackend() const void AudioSettingsWidget::updateDriverNames() { const AudioBackend backend = getEffectiveBackend(); - const std::vector> names = AudioStream::GetDriverNames(backend); + std::vector> names = AudioStream::GetDriverNames(backend); m_ui.driver->disconnect(); m_ui.driver->clear(); @@ -166,7 +166,7 @@ void AudioSettingsWidget::updateDeviceNames() const AudioBackend backend = getEffectiveBackend(); const std::string driver_name = m_dialog->getEffectiveStringValue("Audio", "Driver", ""); const std::string current_device = m_dialog->getEffectiveStringValue("Audio", "Device", ""); - const std::vector devices = + std::vector devices = AudioStream::GetOutputDevices(backend, driver_name.c_str(), SPU::SAMPLE_RATE); m_ui.outputDevice->disconnect(); diff --git a/src/duckstation-qt/gamepatchsettingswidget.cpp b/src/duckstation-qt/gamepatchsettingswidget.cpp index 6d62fa563..474e9edf5 100644 --- a/src/duckstation-qt/gamepatchsettingswidget.cpp +++ b/src/duckstation-qt/gamepatchsettingswidget.cpp @@ -78,9 +78,9 @@ void GamePatchSettingsWidget::disableAllPatches() void GamePatchSettingsWidget::reloadList() { - const std::vector patches = + std::vector patches = Cheats::GetCodeInfoList(m_dialog->getGameSerial(), std::nullopt, false, true, true); - const std::vector enabled_list = + std::vector enabled_list = m_dialog->getSettingsInterface()->GetStringList(Cheats::PATCHES_CONFIG_SECTION, Cheats::PATCH_ENABLE_CONFIG_KEY); delete m_ui.scrollArea->takeWidget(); @@ -93,7 +93,7 @@ void GamePatchSettingsWidget::reloadList() { bool first = true; - for (const Cheats::CodeInfo& pi : patches) + for (Cheats::CodeInfo& pi : patches) { if (!first) { diff --git a/src/duckstation-qt/inputbindingdialog.cpp b/src/duckstation-qt/inputbindingdialog.cpp index a1753832c..15e5bcf97 100644 --- a/src/duckstation-qt/inputbindingdialog.cpp +++ b/src/duckstation-qt/inputbindingdialog.cpp @@ -216,8 +216,8 @@ void InputBindingDialog::addNewBinding() if (m_new_bindings.empty()) return; - const std::string new_binding( - InputManager::ConvertInputBindingKeysToString(m_bind_type, m_new_bindings.data(), m_new_bindings.size())); + std::string new_binding = + InputManager::ConvertInputBindingKeysToString(m_bind_type, m_new_bindings.data(), m_new_bindings.size()); if (!new_binding.empty()) { if (std::find(m_bindings.begin(), m_bindings.end(), new_binding) != m_bindings.end()) diff --git a/src/duckstation-qt/memorycardeditorwindow.cpp b/src/duckstation-qt/memorycardeditorwindow.cpp index d301c058d..d2d3aec47 100644 --- a/src/duckstation-qt/memorycardeditorwindow.cpp +++ b/src/duckstation-qt/memorycardeditorwindow.cpp @@ -106,10 +106,10 @@ bool MemoryCardEditorWindow::setCardB(const QString& path) bool MemoryCardEditorWindow::createMemoryCard(const QString& path, Error* error) { - MemoryCardImage::DataArray data; - MemoryCardImage::Format(&data); + std::unique_ptr data = std::make_unique(); + MemoryCardImage::Format(data.get()); - return MemoryCardImage::SaveToFile(data, path.toUtf8().constData(), error); + return MemoryCardImage::SaveToFile(*data.get(), path.toUtf8().constData(), error); } void MemoryCardEditorWindow::resizeEvent(QResizeEvent* ev) diff --git a/src/duckstation-qt/memoryviewwidget.cpp b/src/duckstation-qt/memoryviewwidget.cpp index 107180acb..b657eec32 100644 --- a/src/duckstation-qt/memoryviewwidget.cpp +++ b/src/duckstation-qt/memoryviewwidget.cpp @@ -280,7 +280,6 @@ void MemoryViewWidget::paintEvent(QPaintEvent* event) int x; int lx = addressWidth(); painter.drawLine(lx - offsetX, 0, lx - offsetX, height()); - y = m_char_height; // hex data const int HEX_CHAR_WIDTH = 4 * m_char_width; diff --git a/src/duckstation-qt/postprocessingsettingswidget.cpp b/src/duckstation-qt/postprocessingsettingswidget.cpp index b39ae24cc..26ea4f253 100644 --- a/src/duckstation-qt/postprocessingsettingswidget.cpp +++ b/src/duckstation-qt/postprocessingsettingswidget.cpp @@ -172,7 +172,7 @@ void PostProcessingChainConfigWidget::onAddButtonClicked() { QMenu menu; - const std::vector> shaders = PostProcessing::GetAvailableShaderNames(); + std::vector> shaders = PostProcessing::GetAvailableShaderNames(); if (shaders.empty()) { menu.addAction(tr("No Shaders Available"))->setEnabled(false); @@ -257,7 +257,7 @@ void PostProcessingChainConfigWidget::onMoveUpButtonClicked() void PostProcessingChainConfigWidget::onMoveDownButtonClicked() { std::optional index = getSelectedIndex(); - if (index.has_value() || index.value() < (static_cast(m_ui.stages->count() - 1))) + if (index.has_value() && index.value() < (static_cast(m_ui.stages->count() - 1))) { auto lock = Host::GetSettingsLock(); SettingsInterface& si = getSettingsInterfaceToUpdate(); diff --git a/src/duckstation-qt/settingswindow.cpp b/src/duckstation-qt/settingswindow.cpp index c4f9fd81b..477bf98ea 100644 --- a/src/duckstation-qt/settingswindow.cpp +++ b/src/duckstation-qt/settingswindow.cpp @@ -51,8 +51,7 @@ SettingsWindow::SettingsWindow() : QWidget() SettingsWindow::SettingsWindow(const std::string& path, std::string title, std::string serial, GameHash hash, DiscRegion region, const GameDatabase::Entry* entry, std::unique_ptr sif) - : QWidget(), m_sif(std::move(sif)), m_database_entry(entry), m_title(std::move(title)), m_serial(std::move(serial)), - m_hash(hash) + : QWidget(), m_sif(std::move(sif)), m_database_entry(entry), m_serial(std::move(serial)), m_hash(hash) { m_ui.setupUi(this); setGameTitle(std::move(title)); diff --git a/src/duckstation-qt/settingwidgetbinder.h b/src/duckstation-qt/settingwidgetbinder.h index bc782bfc5..d3b5bd2d4 100644 --- a/src/duckstation-qt/settingwidgetbinder.h +++ b/src/duckstation-qt/settingwidgetbinder.h @@ -500,7 +500,7 @@ struct SettingAccessor else { widget->setContextMenuPolicy(Qt::CustomContextMenu); - widget->connect(widget, &QSpinBox::customContextMenuRequested, widget, [widget, func](const QPoint& pt) { + widget->connect(widget, &QSpinBox::customContextMenuRequested, widget, [widget, func](const QPoint& pt) mutable { QMenu menu(widget); widget->connect(menu.addAction(qApp->translate("SettingWidgetBinder", "Reset")), &QAction::triggered, widget, [widget, func = std::move(func)]() { diff --git a/src/util/cd_image_memory.cpp b/src/util/cd_image_memory.cpp index df8de4132..49be1856e 100644 --- a/src/util/cd_image_memory.cpp +++ b/src/util/cd_image_memory.cpp @@ -54,8 +54,8 @@ bool CDImageMemory::CopyImage(CDImage* image, ProgressCallback* progress) m_memory_sectors += image->GetIndex(i).length; } - if ((static_cast(RAW_SECTOR_SIZE) * static_cast(m_memory_sectors)) >= - static_cast(std::numeric_limits::max())) + if (m_memory_sectors == 0 || (static_cast(RAW_SECTOR_SIZE) * static_cast(m_memory_sectors)) >= + static_cast(std::numeric_limits::max())) { progress->ModalError("Insufficient address space"); return false; diff --git a/src/util/d3d12_device.cpp b/src/util/d3d12_device.cpp index a5b49a7df..b65dbf6ea 100644 --- a/src/util/d3d12_device.cpp +++ b/src/util/d3d12_device.cpp @@ -1906,7 +1906,6 @@ void D3D12Device::BeginRenderPass() D3D12Texture* const ds = m_current_depth_target; ds->TransitionToState(cmdlist, D3D12_RESOURCE_STATE_DEPTH_WRITE); ds->SetUseFenceValue(GetCurrentFenceValue()); - ds_desc_p = &ds_desc; ds_desc.cpuDescriptor = ds->GetWriteDescriptor(); ds_desc.DepthEndingAccess.Type = D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE; ds_desc.StencilBeginningAccess = {}; @@ -2059,13 +2058,9 @@ bool D3D12Device::IsRenderTargetBound(const GPUTexture* tex) const void D3D12Device::InvalidateCachedState() { + DebugAssert(!m_in_render_pass);; m_dirty_flags = ALL_DIRTY_STATE & ((m_current_render_pass_flags & GPUPipeline::BindRenderTargetsAsImages) ? ~0u : ~DIRTY_FLAG_RT_UAVS); - m_in_render_pass = false; - m_current_pipeline = nullptr; - m_current_vertex_stride = 0; - m_current_blend_constant = 0; - m_current_topology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; } void D3D12Device::SetInitialPipelineState() diff --git a/src/util/d3d12_pipeline.cpp b/src/util/d3d12_pipeline.cpp index 84088a3ef..8a1a83153 100644 --- a/src/util/d3d12_pipeline.cpp +++ b/src/util/d3d12_pipeline.cpp @@ -73,7 +73,9 @@ D3D12Pipeline::D3D12Pipeline(Microsoft::WRL::ComPtr pipelin D3D12Pipeline::~D3D12Pipeline() { - D3D12Device::GetInstance().DeferObjectDestruction(std::move(m_pipeline)); + D3D12Device& dev = D3D12Device::GetInstance(); + dev.UnbindPipeline(this); + dev.DeferObjectDestruction(std::move(m_pipeline)); } #ifdef ENABLE_GPU_OBJECT_NAMES diff --git a/src/util/dinput_source.cpp b/src/util/dinput_source.cpp index 2bc65c8a4..3802a36c0 100644 --- a/src/util/dinput_source.cpp +++ b/src/util/dinput_source.cpp @@ -227,7 +227,7 @@ bool DInputSource::AddDevice(ControllerData& cd, const std::string& name) range.diph.dwObj = static_cast(offset); range.lMin = std::numeric_limits::min(); range.lMax = std::numeric_limits::max(); - hr = cd.device->SetProperty(DIPROP_RANGE, &range.diph); + cd.device->SetProperty(DIPROP_RANGE, &range.diph); // did it apply? if (SUCCEEDED(cd.device->GetProperty(DIPROP_RANGE, &range.diph))) diff --git a/src/util/gpu_device.cpp b/src/util/gpu_device.cpp index d6bd40675..7686a96ac 100644 --- a/src/util/gpu_device.cpp +++ b/src/util/gpu_device.cpp @@ -1188,7 +1188,7 @@ std::unique_ptr GPUDevice::FetchTexture(u32 width, u32 height, u32 l error ? error : &create_error, "Failed to create {}x{} {} {}: {}", width, height, GPUTexture::GetFormatName(format), ((type == GPUTexture::Type::RenderTarget) ? "RT" : (type == GPUTexture::Type::DepthStencil ? "DS" : "Texture")), - create_error.TakeDescription()); + create_error.GetDescription()); if (!error) ERROR_LOG(create_error.GetDescription()); } diff --git a/src/util/input_source.cpp b/src/util/input_source.cpp index 8544f16b4..482bb9de4 100644 --- a/src/util/input_source.cpp +++ b/src/util/input_source.cpp @@ -141,7 +141,7 @@ std::string InputSource::ConvertGenericControllerKeyToString(InputBindingKey key { if (key.source_subtype == InputSubclass::ControllerAxis) { - const char* modifier = ""; + const char* modifier; switch (key.modifier) { case InputModifier::None: @@ -153,6 +153,9 @@ std::string InputSource::ConvertGenericControllerKeyToString(InputBindingKey key case InputModifier::FullAxis: modifier = "Full"; break; + default: + modifier = ""; + break; } return fmt::format("{}-{}/{}Axis{}", InputManager::InputSourceToString(key.source_type), static_cast(key.source_index), modifier, key.data); diff --git a/src/util/media_capture.cpp b/src/util/media_capture.cpp index 57258e4fa..f3eebbdc9 100644 --- a/src/util/media_capture.cpp +++ b/src/util/media_capture.cpp @@ -1652,6 +1652,7 @@ bool MediaCaptureMF::GetAudioTypes(std::string_view codec, ComPtr* if (output_subtype == AUDIO_INPUT_MEDIA_FORMAT) { *output_type = std::move(*input_type); + *input_type = ComPtr(); return true; } diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index c4cc0125a..237a54cd4 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -3536,10 +3536,9 @@ void VulkanDevice::UnbindPipeline(VulkanPipeline* pl) void VulkanDevice::InvalidateCachedState() { + DebugAssert(!m_current_render_pass); m_dirty_flags = ALL_DIRTY_STATE | ((m_current_render_pass_flags & GPUPipeline::ColorFeedbackLoop) ? DIRTY_FLAG_INPUT_ATTACHMENT : 0); - m_current_render_pass = VK_NULL_HANDLE; - m_current_pipeline = nullptr; } s32 VulkanDevice::IsRenderTargetBoundIndex(const GPUTexture* tex) const diff --git a/src/util/vulkan_pipeline.cpp b/src/util/vulkan_pipeline.cpp index 7a6c76b87..b0f74bd4c 100644 --- a/src/util/vulkan_pipeline.cpp +++ b/src/util/vulkan_pipeline.cpp @@ -108,7 +108,9 @@ VulkanPipeline::VulkanPipeline(VkPipeline pipeline, Layout layout, u8 vertices_p VulkanPipeline::~VulkanPipeline() { - VulkanDevice::GetInstance().DeferPipelineDestruction(m_pipeline); + VulkanDevice& dev = VulkanDevice::GetInstance(); + dev.UnbindPipeline(this); + dev.DeferPipelineDestruction(m_pipeline); } #ifdef ENABLE_GPU_OBJECT_NAMES