From c2e5d2468ad6a38cdb8a067da0678302f6cc6066 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 13 Sep 2019 15:59:15 -0400 Subject: Refactor render-test to make cross platform (#1053) * First pass of render-test refactor. * Make window construction a function that can choose an implementation. * Remove OpenGL as currently has windows dependency. * Disable Vulkan as Renderer impl has dependency on windows. * Pass Window in as parameter of 'update'. * Add win-window.cpp as was missing. * Fix warning on windows about signs during comparison. --- tools/gfx/vk-device-queue.h | 94 --------------------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 tools/gfx/vk-device-queue.h (limited to 'tools/gfx/vk-device-queue.h') diff --git a/tools/gfx/vk-device-queue.h b/tools/gfx/vk-device-queue.h deleted file mode 100644 index d57483ec0..000000000 --- a/tools/gfx/vk-device-queue.h +++ /dev/null @@ -1,94 +0,0 @@ -// vk-swap-chain.h -#pragma once - -#include "vk-api.h" - -namespace gfx { - -struct VulkanDeviceQueue -{ - enum - { - kMaxCommandBuffers = 8, - }; - - enum class EventType - { - BeginFrame, - EndFrame, - CountOf, - }; - - /// Initialize - must be called before anything else can be done - SlangResult init(const VulkanApi& api, VkQueue queue, int queueIndex); - - /// Flushes the current command list, and steps to next (internally this is equivalent to a stepA followed by stepB) - void flush(); - /// Performs a full flush, and then waits for idle. - void flushAndWait(); - - /// Blocks until all work submitted to GPU has completed - void waitForIdle() { m_api->vkQueueWaitIdle(m_queue); } - - /// Get the graphics queue index (as set on init) - int getQueueIndex() const { return m_queueIndex; } - - /// Make the specified event 'current' - meaning it's semaphore must be waited on - VkSemaphore makeCurrent(EventType eventType); - /// Makes the event no longer required to be waited on - void makeCompleted(EventType eventType); - /// Returns true if the event is already current - SLANG_FORCE_INLINE bool isCurrent(EventType eventType) const { return m_currentSemaphores[int(eventType)] != VK_NULL_HANDLE; } - - /// Get the command buffer - VkCommandBuffer getCommandBuffer() const { return m_commandBuffer; } - - /// Get the queue - VkQueue getQueue() const { return m_queue; } - - /// Get the API - const VulkanApi* getApi() const { return m_api; } - - /// Flushes the current command list - void flushStepA(); - /// Steps to next command buffer and opens. May block if command buffer is still in use - void flushStepB(); - - /// Dtor - ~VulkanDeviceQueue(); - - protected: - - struct Fence - { - VkFence fence; - bool active; - uint64_t value; - }; - - void _updateFenceAtIndex(int fenceIndex, bool blocking); - - VkQueue m_queue = VK_NULL_HANDLE; - - VkCommandPool m_commandPool = VK_NULL_HANDLE; - int m_numCommandBuffers = 0; - int m_commandBufferIndex = 0; - // There are the same amount of command buffers as fences - VkCommandBuffer m_commandBuffers[kMaxCommandBuffers] = { VK_NULL_HANDLE }; - - Fence m_fences[kMaxCommandBuffers] = { {VK_NULL_HANDLE, 0, 0u} }; - - VkCommandBuffer m_commandBuffer = VK_NULL_HANDLE; - - VkSemaphore m_semaphores[int(EventType::CountOf)]; - VkSemaphore m_currentSemaphores[int(EventType::CountOf)]; - - uint64_t m_lastFenceCompleted = 1; - uint64_t m_nextFenceValue = 2; - - int m_queueIndex = 0; - - const VulkanApi* m_api = nullptr; -}; - -} // renderer_test -- cgit v1.2.3