Clase que contiene la información sobre el destino de las imágenes a generar (swapchain, vistas, colas de comandos). Más...
#include <GEDrawingContext.h>
Métodos públicos | |
| GEDrawingContext (GEGraphicsContext *gc, GEWindowPosition wpos) | |
| Crea el contexto de dibujo (swapchain, vistas y sincronización). | |
| void | destroy (GEGraphicsContext *gc) |
| Destruye los recursos del contexto de dibujo. | |
| void | recreate (GEGraphicsContext *gc, GEWindowPosition wpos) |
| Reconstruye el contexto de dibujo tras un cambio de tamaño. | |
| VkFormat | getFormat () |
| Obtiene el formato de la imagen. | |
| VkExtent2D | getExtent () |
| Obtiene la extensión de la imagen. | |
| uint32_t | getImageCount () |
| Obtiene el número de imágenes de la swapchain. | |
| uint32_t | getCurrentImage () |
| Obtiene el índice de la imagen actual. | |
| void | waitForNextImage (GEGraphicsContext *gc) |
| Espera y adquiere la siguiente imagen disponible. | |
| void | submitGraphicsCommands (GEGraphicsContext *gc, std::vector< VkCommandBuffer > commandBuffers) |
| Envía los comandos gráficos para la imagen actual. | |
| void | submitPresentCommands (GEGraphicsContext *gc) |
| Envía los comandos de presentación para la imagen actual. | |
Atributos públicos | |
| std::vector< VkImageView > | imageViews |
| Vistas de las imágenes del swapchain. | |
Métodos privados | |
| void | createSwapChain (GEGraphicsContext *gc, GEWindowPosition wpos) |
| Crea el swapchain y obtiene las imágenes y formatos adecuados. | |
| void | createImageViews (VkDevice device) |
| Crea una vista para cada imagen del swapchain. | |
| void | createSyncObjects (VkDevice device) |
| Crea semáforos y fences para sincronización entre frames. | |
| void | createQueues (GEGraphicsContext *gc) |
| Obtiene las colas gráficas y de presentación del dispositivo. | |
| VkSurfaceFormatKHR | chooseSwapSurfaceFormat (const std::vector< VkSurfaceFormatKHR > &availableFormats) |
| Escoge el formato de imagen entre los soportados por la superficie. | |
| VkExtent2D | chooseSwapExtent (const VkSurfaceCapabilitiesKHR &capabilities, GEWindowPosition wpos) |
| Selecciona la extensión (tamaño) adecuada para las imágenes del swapchain. | |
Atributos privados | |
| uint32_t | imageCount |
| Número de imágenes en la swapchain. | |
| uint32_t | frameCount |
| Número de frames en vuelo. | |
| size_t | currentFrame = 0 |
| Índice del frame actual. | |
| uint32_t | currentImage = 0 |
| Índice de la imagen actual. | |
| VkSwapchainKHR | swapChain |
| Swapchain de Vulkan. | |
| VkFormat | imageFormat |
| Formato de imagen. | |
| VkExtent2D | imageExtent |
| Extensión de las imágenes. | |
| std::vector< VkImage > | images |
| Imágenes de la swapchain. | |
| VkQueue | graphicsQueue |
| Cola gráfica. | |
| VkQueue | presentQueue |
| Cola de presentación. | |
| std::vector< VkSemaphore > | imageAvailableSemaphores |
| Semáforos de imagen disponible. | |
| std::vector< VkSemaphore > | renderFinishedSemaphores |
| Semáforos de render terminado. | |
| std::vector< VkFence > | inFlightFences |
| Fences por frame. | |
| std::vector< VkFence > | imagesInFlight |
| Fence por imagen. | |
Clase que contiene la información sobre el destino de las imágenes a generar (swapchain, vistas, colas de comandos).
| GEDrawingContext::GEDrawingContext | ( | GEGraphicsContext * | gc, |
| GEWindowPosition | wpos ) |
Crea el contexto de dibujo (swapchain, vistas y sincronización).
| gc | Contexto gráfico. |
| wpos | Posición y tamaño de la ventana. |
Hace referencia a createImageViews(), createQueues(), createSwapChain(), createSyncObjects() y GEGraphicsContext::device.
|
private |
Selecciona la extensión (tamaño) adecuada para las imágenes del swapchain.
| capabilities | Capacidades de la superficie. |
| wpos | Posición y tamaño de la ventana. |
Hace referencia a GEWindowPosition::fullScreen, GEWindowPosition::height, GEWindowPosition::screenHeight, GEWindowPosition::screenWidth y GEWindowPosition::width.
Referenciado por createSwapChain().
|
private |
Escoge el formato de imagen entre los soportados por la superficie.
| availableFormats | Formatos disponibles. |
Referenciado por createSwapChain().
|
private |
Crea una vista para cada imagen del swapchain.
| device | Dispositivo Vulkan. |
Hace referencia a imageCount, imageFormat, images y imageViews.
Referenciado por GEDrawingContext() y recreate().
|
private |
Obtiene las colas gráficas y de presentación del dispositivo.
| gc | Contexto gráfico. |
Hace referencia a GEGraphicsContext::device, graphicsQueue, GEGraphicsContext::graphicsQueueFamilyIndex, presentQueue y GEGraphicsContext::presentQueueFamilyIndex.
Referenciado por GEDrawingContext().
|
private |
Crea el swapchain y obtiene las imágenes y formatos adecuados.
| gc | Contexto gráfico. |
| wpos | Posición y tamaño de la ventana. |
Hace referencia a chooseSwapExtent(), chooseSwapSurfaceFormat(), GEGraphicsContext::device, GEGraphicsContext::graphicsQueueFamilyIndex, imageCount, imageExtent, imageFormat, images, GEGraphicsContext::physicalDevice, GEGraphicsContext::presentQueueFamilyIndex, GEGraphicsContext::surface y swapChain.
Referenciado por GEDrawingContext() y recreate().
|
private |
Crea semáforos y fences para sincronización entre frames.
| device | Dispositivo Vulkan. |
Hace referencia a frameCount, imageAvailableSemaphores, imageCount, images, imagesInFlight, inFlightFences y renderFinishedSemaphores.
Referenciado por GEDrawingContext().
| void GEDrawingContext::destroy | ( | GEGraphicsContext * | gc | ) |
Destruye los recursos del contexto de dibujo.
| gc | Contexto gráfico. |
Hace referencia a GEGraphicsContext::device, frameCount, imageAvailableSemaphores, imageCount, imageViews, inFlightFences, renderFinishedSemaphores y swapChain.
| uint32_t GEDrawingContext::getCurrentImage | ( | ) |
| VkExtent2D GEDrawingContext::getExtent | ( | ) |
Obtiene la extensión de la imagen.
Obtiene la extensión (tamaño) de las imágenes.
Hace referencia a imageExtent.
Referenciado por GERenderingContext::GERenderingContext(), GEScene::GEScene() y GEScene::recreate().
| VkFormat GEDrawingContext::getFormat | ( | ) |
Obtiene el formato de la imagen.
Obtiene el formato de imagen de la swapchain.
Hace referencia a imageFormat.
Referenciado por GERenderingContext::GERenderingContext().
| uint32_t GEDrawingContext::getImageCount | ( | ) |
Obtiene el número de imágenes de la swapchain.
Hace referencia a imageCount.
Referenciado por GERenderingContext::GERenderingContext().
| void GEDrawingContext::recreate | ( | GEGraphicsContext * | gc, |
| GEWindowPosition | wpos ) |
Reconstruye el contexto de dibujo tras un cambio de tamaño.
Reconstruye los componentes del contexto de dibujo tras un cambio de tamaño.
| gc | Contexto gráfico. |
| wpos | Nueva posición/tamaño de la ventana. |
Hace referencia a createImageViews(), createSwapChain(), GEGraphicsContext::device, imageCount, imageViews y swapChain.
| void GEDrawingContext::submitGraphicsCommands | ( | GEGraphicsContext * | gc, |
| std::vector< VkCommandBuffer > | commandBuffers ) |
Envía los comandos gráficos para la imagen actual.
Envía los comandos gráficos al dispositivo para la imagen actual.
| gc | Contexto gráfico. |
| commandBuffers | Vector con los command buffers. |
Hace referencia a currentFrame, currentImage, GEGraphicsContext::device, graphicsQueue, imageAvailableSemaphores, imagesInFlight, inFlightFences y renderFinishedSemaphores.
| void GEDrawingContext::submitPresentCommands | ( | GEGraphicsContext * | gc | ) |
Envía los comandos de presentación para la imagen actual.
Envía los comandos de presentación al dispositivo para mostrar la imagen.
| gc | Contexto gráfico. |
Hace referencia a currentFrame, currentImage, frameCount, presentQueue, renderFinishedSemaphores y swapChain.
| void GEDrawingContext::waitForNextImage | ( | GEGraphicsContext * | gc | ) |
Espera y adquiere la siguiente imagen disponible.
Espera y adquiere la siguiente imagen disponible para render.
| gc | Contexto gráfico. |
Hace referencia a currentFrame, currentImage, GEGraphicsContext::device, imageAvailableSemaphores, inFlightFences y swapChain.
|
private |
Índice del frame actual.
Referenciado por submitGraphicsCommands(), submitPresentCommands() y waitForNextImage().
|
private |
Índice de la imagen actual.
Referenciado por getCurrentImage(), submitGraphicsCommands(), submitPresentCommands() y waitForNextImage().
|
private |
Número de frames en vuelo.
Referenciado por createSyncObjects(), destroy() y submitPresentCommands().
|
private |
Cola gráfica.
Referenciado por createQueues() y submitGraphicsCommands().
|
private |
Semáforos de imagen disponible.
Referenciado por createSyncObjects(), destroy(), submitGraphicsCommands() y waitForNextImage().
|
private |
Número de imágenes en la swapchain.
Referenciado por createImageViews(), createSwapChain(), createSyncObjects(), destroy(), getImageCount() y recreate().
|
private |
Extensión de las imágenes.
Referenciado por createSwapChain() y getExtent().
|
private |
Formato de imagen.
Referenciado por createImageViews(), createSwapChain() y getFormat().
|
private |
Imágenes de la swapchain.
Referenciado por createImageViews(), createSwapChain() y createSyncObjects().
|
private |
Fence por imagen.
Referenciado por createSyncObjects() y submitGraphicsCommands().
| std::vector<VkImageView> GEDrawingContext::imageViews |
Vistas de las imágenes del swapchain.
Referenciado por GERenderingContext::createFramebuffers(), createImageViews(), destroy() y recreate().
|
private |
Fences por frame.
Referenciado por createSyncObjects(), destroy(), submitGraphicsCommands() y waitForNextImage().
|
private |
Cola de presentación.
Referenciado por createQueues() y submitPresentCommands().
|
private |
Semáforos de render terminado.
Referenciado por createSyncObjects(), destroy(), submitGraphicsCommands() y submitPresentCommands().
|
private |
Swapchain de Vulkan.
Referenciado por createSwapChain(), destroy(), recreate(), submitPresentCommands() y waitForNextImage().