summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. Chat <arkolbed@gmail.com>2018-05-15 11:48:51 -0500
committerDr. Chat <arkolbed@gmail.com>2018-10-12 14:54:13 -0500
commit573d31414099ba2c23c2a5bb3e5b0a2b0d5df07d (patch)
treeb62eb2e1952d57dd6401feaeeb7e7b6bb8784e08
parent4c99805cf23c777a11b632477e058b146c11fed4 (diff)
[GPU] Axe GraphicsSystem::Swap
-rw-r--r--src/xenia/gpu/graphics_system.cc2
-rw-r--r--src/xenia/gpu/graphics_system.h2
-rw-r--r--src/xenia/gpu/null/null_graphics_system.cc9
-rw-r--r--src/xenia/gpu/null/null_graphics_system.h1
-rw-r--r--src/xenia/gpu/vulkan/vulkan_graphics_system.cc68
-rw-r--r--src/xenia/gpu/vulkan/vulkan_graphics_system.h1
6 files changed, 2 insertions, 81 deletions
diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc
index 08d3107a9..7c13b7864 100644
--- a/src/xenia/gpu/graphics_system.cc
+++ b/src/xenia/gpu/graphics_system.cc
@@ -17,8 +17,8 @@
#include "xenia/base/threading.h"
#include "xenia/gpu/command_processor.h"
#include "xenia/gpu/gpu_flags.h"
+#include "xenia/ui/graphics_context.h"
#include "xenia/ui/graphics_provider.h"
-#include "xenia/ui/loop.h"
namespace xe {
namespace gpu {
diff --git a/src/xenia/gpu/graphics_system.h b/src/xenia/gpu/graphics_system.h
index c2ee28dcd..05d245fd3 100644
--- a/src/xenia/gpu/graphics_system.h
+++ b/src/xenia/gpu/graphics_system.h
@@ -19,7 +19,6 @@
#include "xenia/gpu/register_file.h"
#include "xenia/kernel/xthread.h"
#include "xenia/memory.h"
-#include "xenia/ui/window.h"
#include "xenia/xbox.h"
namespace xe {
@@ -112,7 +111,6 @@ class GraphicsSystem {
void WriteRegister(uint32_t addr, uint32_t value);
void MarkVblank();
- virtual void Swap(xe::ui::UIEvent* e) = 0;
Memory* memory_ = nullptr;
cpu::Processor* processor_ = nullptr;
diff --git a/src/xenia/gpu/null/null_graphics_system.cc b/src/xenia/gpu/null/null_graphics_system.cc
index 914a604e3..61de2b4d0 100644
--- a/src/xenia/gpu/null/null_graphics_system.cc
+++ b/src/xenia/gpu/null/null_graphics_system.cc
@@ -34,15 +34,6 @@ std::unique_ptr<CommandProcessor> NullGraphicsSystem::CreateCommandProcessor() {
new NullCommandProcessor(this, kernel_state_));
}
-void NullGraphicsSystem::Swap(xe::ui::UIEvent* e) {
- if (!command_processor_) {
- return;
- }
-
- std::lock_guard<std::mutex> lock(swap_state_.mutex);
- swap_state_.pending = false;
-}
-
} // namespace null
} // namespace gpu
} // namespace xe \ No newline at end of file
diff --git a/src/xenia/gpu/null/null_graphics_system.h b/src/xenia/gpu/null/null_graphics_system.h
index 45ce71ad9..4f82dd7fd 100644
--- a/src/xenia/gpu/null/null_graphics_system.h
+++ b/src/xenia/gpu/null/null_graphics_system.h
@@ -34,7 +34,6 @@ class NullGraphicsSystem : public GraphicsSystem {
private:
std::unique_ptr<CommandProcessor> CreateCommandProcessor() override;
- void Swap(xe::ui::UIEvent* e) override;
SwapState swap_state_ = {};
};
diff --git a/src/xenia/gpu/vulkan/vulkan_graphics_system.cc b/src/xenia/gpu/vulkan/vulkan_graphics_system.cc
index 5c90ede3b..91c1979fd 100644
--- a/src/xenia/gpu/vulkan/vulkan_graphics_system.cc
+++ b/src/xenia/gpu/vulkan/vulkan_graphics_system.cc
@@ -18,10 +18,7 @@
#include "xenia/gpu/gpu_flags.h"
#include "xenia/gpu/vulkan/vulkan_command_processor.h"
#include "xenia/gpu/vulkan/vulkan_gpu_flags.h"
-#include "xenia/ui/vulkan/vulkan_provider.h"
-#include "xenia/ui/vulkan/vulkan_swap_chain.h"
-#include "xenia/ui/vulkan/vulkan_util.h"
-#include "xenia/ui/window.h"
+#include "xenia/ui/vulkan/vulkan_context.h"
namespace xe {
namespace gpu {
@@ -323,69 +320,6 @@ VulkanGraphicsSystem::CreateCommandProcessor() {
return std::make_unique<VulkanCommandProcessor>(this, kernel_state_);
}
-void VulkanGraphicsSystem::Swap(xe::ui::UIEvent* e) {
- if (!command_processor_) {
- return;
- }
-
- // Check for pending swap.
- if (display_context_->WasLost()) {
- // We're crashing. Cheese it.
- swap_state_.pending = false;
- return;
- }
-
- {
- std::lock_guard<std::mutex> lock(swap_state_.mutex);
- if (!swap_state_.pending) {
- // return;
- }
-
- swap_state_.pending = false;
- }
-
- if (!swap_state_.front_buffer_texture) {
- // Not yet ready.
- return;
- }
-
- auto swap_chain = display_context_->swap_chain();
- auto copy_cmd_buffer = swap_chain->copy_cmd_buffer();
- auto front_buffer =
- reinterpret_cast<VkImage>(swap_state_.front_buffer_texture);
-
- VkImageMemoryBarrier barrier;
- std::memset(&barrier, 0, sizeof(VkImageMemoryBarrier));
- barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
- barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
- barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
- barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL;
- barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- barrier.image = front_buffer;
- barrier.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
- vkCmdPipelineBarrier(copy_cmd_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT,
- VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0,
- nullptr, 1, &barrier);
-
- VkImageBlit region;
- region.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
- region.srcOffsets[0] = {0, 0, 0};
- region.srcOffsets[1] = {static_cast<int32_t>(swap_state_.width),
- static_cast<int32_t>(swap_state_.height), 1};
-
- region.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1};
- region.dstOffsets[0] = {0, 0, 0};
- region.dstOffsets[1] = {static_cast<int32_t>(swap_chain->surface_width()),
- static_cast<int32_t>(swap_chain->surface_height()),
- 1};
- vkCmdBlitImage(copy_cmd_buffer, front_buffer, VK_IMAGE_LAYOUT_GENERAL,
- swap_chain->surface_image(),
- VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region,
- VK_FILTER_LINEAR);
-}
-
} // namespace vulkan
} // namespace gpu
} // namespace xe
diff --git a/src/xenia/gpu/vulkan/vulkan_graphics_system.h b/src/xenia/gpu/vulkan/vulkan_graphics_system.h
index f4953260e..0462be017 100644
--- a/src/xenia/gpu/vulkan/vulkan_graphics_system.h
+++ b/src/xenia/gpu/vulkan/vulkan_graphics_system.h
@@ -49,7 +49,6 @@ class VulkanGraphicsSystem : public GraphicsSystem {
void DestroySwapImage();
std::unique_ptr<CommandProcessor> CreateCommandProcessor() override;
- void Swap(xe::ui::UIEvent* e) override;
ui::vulkan::VulkanDevice* device_ = nullptr;
ui::vulkan::VulkanContext* display_context_ = nullptr;