Skip to content

Commit

Permalink
Merge pull request #18135 from hrydgard/assorted-fixes-6
Browse files Browse the repository at this point in the history
Fix closing the chat window with ESC, add some asserts
  • Loading branch information
hrydgard authored Sep 11, 2023
2 parents 16af427 + 9740435 commit dbbf8e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
3 changes: 1 addition & 2 deletions Common/GPU/Vulkan/VulkanRenderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ class VulkanRenderManager {
}

void BindPipeline(VKRGraphicsPipeline *pipeline, PipelineFlags flags, VkPipelineLayout pipelineLayout) {
_dbg_assert_(curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
_dbg_assert_(pipeline != nullptr);
_assert_(curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER && pipeline != nullptr);
VkRenderData &data = curRenderStep_->commands.push_uninitialized();
data.cmd = VKRRenderCommand::BIND_GRAPHICS_PIPELINE;
pipelinesToCheck_.push_back(pipeline);
Expand Down
6 changes: 3 additions & 3 deletions Common/UI/UIScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ bool UIScreen::UnsyncTouch(const TouchInput &touch) {
}
}

std::lock_guard<std::mutex> guard(eventQueueLock_);
QueuedEvent ev{};
ev.type = QueuedEventType::TOUCH;
ev.touch = touch;
std::lock_guard<std::mutex> guard(eventQueueLock_);
eventQueue_.push_back(ev);
return false;
}

void UIScreen::UnsyncAxis(const AxisInput &axis) {
std::lock_guard<std::mutex> guard(eventQueueLock_);
QueuedEvent ev{};
ev.type = QueuedEventType::AXIS;
ev.axis = axis;
std::lock_guard<std::mutex> guard(eventQueueLock_);
eventQueue_.push_back(ev);
}

Expand All @@ -123,10 +123,10 @@ bool UIScreen::UnsyncKey(const KeyInput &key) {
}
}

std::lock_guard<std::mutex> guard(eventQueueLock_);
QueuedEvent ev{};
ev.type = QueuedEventType::KEY;
ev.key = key;
std::lock_guard<std::mutex> guard(eventQueueLock_);
eventQueue_.push_back(ev);
return retval;
}
Expand Down
5 changes: 5 additions & 0 deletions GPU/Vulkan/PipelineManagerVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ static std::string CutFromMain(std::string str) {
static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager, VkPipelineCache pipelineCache,
VkPipelineLayout layout, PipelineFlags pipelineFlags, VkSampleCountFlagBits sampleCount, const VulkanPipelineRasterStateKey &key,
const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, VulkanGeometryShader *gs, bool useHwTransform, u32 variantBitmask, bool cacheLoad) {
_assert_(fs && vs);

if (!fs->GetModule()) {
ERROR_LOG(G3D, "Fragment shader missing in CreateVulkanPipeline");
Expand All @@ -189,6 +190,10 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager,
ERROR_LOG(G3D, "Vertex shader missing in CreateVulkanPipeline");
return nullptr;
}
if (gs && !gs->GetModule()) {
ERROR_LOG(G3D, "Geometry shader missing in CreateVulkanPipeline");
return nullptr;
}

VulkanPipeline *vulkanPipeline = new VulkanPipeline();
vulkanPipeline->desc = new VKRGraphicsPipelineDesc();
Expand Down
8 changes: 4 additions & 4 deletions UI/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,16 +844,16 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) {
System_Notify(SystemNotification::ACTIVITY);

if (UI::IsFocusMovementEnabled()) {
if (UIScreen::UnsyncKey(key)) {
return true;
} else if ((key.flags & KEY_DOWN) != 0 && UI::IsEscapeKey(key)) {
bool retval = UIScreen::UnsyncKey(key);
if ((key.flags & KEY_DOWN) != 0 && UI::IsEscapeKey(key)) {
if (chatMenu_)
chatMenu_->Close();
if (chatButton_)
chatButton_->SetVisibility(UI::V_VISIBLE);
UI::EnableFocusMovement(false);
return true;
retval = true;
}
return retval;
}

return controlMapper_.Key(key, &pauseTrigger_);
Expand Down

0 comments on commit dbbf8e2

Please sign in to comment.