VkCommandBufferInheritanceInfo buf_inh = { 0, };
VkCommandBufferBeginInfo cmd_buf_info = { 0, };
- buf_inh.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
- buf_inh.pNext = NULL;
- buf_inh.renderPass = VK_NULL_HANDLE;
- buf_inh.subpass = 0;
- buf_inh.framebuffer = VK_NULL_HANDLE;
- buf_inh.occlusionQueryEnable = FALSE;
- buf_inh.queryFlags = 0;
- buf_inh.pipelineStatistics = 0;
-
- cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmd_buf_info.pNext = NULL;
- cmd_buf_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- cmd_buf_info.pInheritanceInfo = &buf_inh;
+ /* *INDENT-OFF* */
+ buf_inh = (VkCommandBufferInheritanceInfo) {
+ .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO,
+ .pNext = NULL,
+ .renderPass = VK_NULL_HANDLE,
+ .subpass = 0,
+ .framebuffer = VK_NULL_HANDLE,
+ .occlusionQueryEnable = FALSE,
+ .queryFlags = 0,
+ .pipelineStatistics = 0
+ };
+
+ cmd_buf_info = (VkCommandBufferBeginInfo) {
+ .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
+ .pNext = NULL,
+ .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
+ .pInheritanceInfo = &buf_inh
+ };
+ /* *INDENT-ON* */
err = vkBeginCommandBuffer (cmd, &cmd_buf_info);
if (gst_vulkan_error_to_g_error (err, error, "vkBeginCommandBuffer") < 0)
VkSubmitInfo submit_info = { 0, };
VkPipelineStageFlags stages = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
- submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submit_info.pNext = NULL;
- submit_info.waitSemaphoreCount = 0;
- submit_info.pWaitSemaphores = NULL;
- submit_info.pWaitDstStageMask = &stages;
- submit_info.commandBufferCount = 1;
- submit_info.pCommandBuffers = &cmd;
- submit_info.signalSemaphoreCount = 0;
- submit_info.pSignalSemaphores = NULL;
+ /* *INDENT-OFF* */
+ submit_info = (VkSubmitInfo) {
+ .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
+ .pNext = NULL,
+ .waitSemaphoreCount = 0,
+ .pWaitSemaphores = NULL,
+ .pWaitDstStageMask = &stages,
+ .commandBufferCount = 1,
+ .pCommandBuffers = &cmd,
+ .signalSemaphoreCount = 0,
+ .pSignalSemaphores = NULL,
+ };
+ /* *INDENT-ON* */
err =
vkQueueSubmit (swapper->queue->queue, 1, &submit_info,
old_swap_chain = swapper->swap_chain;
- swap_chain_info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
- swap_chain_info.pNext = NULL;
- swap_chain_info.surface = swapper->surface;
- swap_chain_info.minImageCount = n_images_wanted;
- swap_chain_info.imageFormat = format;
- swap_chain_info.imageColorSpace = color_space;
- swap_chain_info.imageExtent = swapchain_dims;
- swap_chain_info.imageArrayLayers = 1;
- swap_chain_info.imageUsage = usage;
- swap_chain_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
- swap_chain_info.queueFamilyIndexCount = 0;
- swap_chain_info.pQueueFamilyIndices = NULL;
- swap_chain_info.preTransform = preTransform;
- swap_chain_info.presentMode = present_mode;
- swap_chain_info.compositeAlpha = alpha_flags;
- swap_chain_info.clipped = TRUE;
- swap_chain_info.oldSwapchain = swapper->swap_chain;
+ /* *INDENT-OFF* */
+ swap_chain_info = (VkSwapchainCreateInfoKHR) {
+ .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
+ .pNext = NULL,
+ .surface = swapper->surface,
+ .minImageCount = n_images_wanted,
+ .imageFormat = format,
+ .imageColorSpace = color_space,
+ .imageExtent = swapchain_dims,
+ .imageArrayLayers = 1,
+ .imageUsage = usage,
+ .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
+ .queueFamilyIndexCount = 0,
+ .pQueueFamilyIndices = NULL,
+ .preTransform = preTransform,
+ .presentMode = present_mode,
+ .compositeAlpha = alpha_flags,
+ .clipped = TRUE,
+ .oldSwapchain = old_swap_chain
+ };
+ /* *INDENT-ON* */
err =
swapper->CreateSwapchainKHR (swapper->device->device, &swap_chain_info,
VkCommandBufferInheritanceInfo buf_inh = { 0, };
VkCommandBufferBeginInfo cmd_buf_info = { 0, };
- buf_inh.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
- buf_inh.pNext = NULL;
- buf_inh.renderPass = VK_NULL_HANDLE;
- buf_inh.subpass = 0;
- buf_inh.framebuffer = VK_NULL_HANDLE;
- buf_inh.occlusionQueryEnable = FALSE;
- buf_inh.queryFlags = 0;
- buf_inh.pipelineStatistics = 0;
-
- cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmd_buf_info.pNext = NULL;
- cmd_buf_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- cmd_buf_info.pInheritanceInfo = &buf_inh;
+ /* *INDENT-OFF* */
+ buf_inh = (VkCommandBufferInheritanceInfo) {
+ .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO,
+ .pNext = NULL,
+ .renderPass = VK_NULL_HANDLE,
+ .subpass = 0,
+ .framebuffer = VK_NULL_HANDLE,
+ .occlusionQueryEnable = FALSE,
+ .queryFlags = 0,
+ .pipelineStatistics = 0
+ };
+
+ cmd_buf_info = (VkCommandBufferBeginInfo) {
+ .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
+ .pNext = NULL,
+ .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
+ .pInheritanceInfo = &buf_inh
+ };
+ /* *INDENT-ON* */
err = vkBeginCommandBuffer (cmd, &cmd_buf_info);
if (gst_vulkan_error_to_g_error (err, error, "vkBeginCommandBuffer") < 0)
GstVulkanBufferMemory *buf_mem = (GstVulkanBufferMemory *) in_mem;
VkBufferImageCopy region = { 0, };
- GST_VK_BUFFER_IMAGE_COPY (region, 0, src.w, src.h,
- GST_VK_IMAGE_SUBRESOURCE_LAYERS_INIT (VK_IMAGE_ASPECT_COLOR_BIT, 0, 0,
- 1), GST_VK_OFFSET3D_INIT (rslt.x, rslt.y, 0),
- GST_VK_EXTENT3D_INIT (rslt.w, rslt.h, 1));
+ /* *INDENT-OFF* */
+ region = (VkBufferImageCopy) {
+ .bufferOffset = 0,
+ .bufferRowLength = src.w,
+ .bufferImageHeight = src.h,
+ .imageSubresource = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .mipLevel = 0,
+ .baseArrayLayer = 0,
+ .layerCount = 1,
+ },
+ .imageOffset = { .x = rslt.x, .y = rslt.y, .z = 0, },
+ .imageExtent = {
+ .width = rslt.w,
+ .height = rslt.h,
+ .depth = 1,
+ }
+ };
+ /* *INDENT-ON* */
vkCmdCopyBufferToImage (cmd, buf_mem->buffer, swap_mem->image,
swap_mem->image_layout, 1, ®ion);
VkImageCopy region = { 0, };
/* FIXME: should really be a blit to resize to the output dimensions */
- GST_VK_IMAGE_COPY (region,
- GST_VK_IMAGE_SUBRESOURCE_LAYERS_INIT (VK_IMAGE_ASPECT_COLOR_BIT, 0, 0,
- 1), GST_VK_OFFSET3D_INIT (src.x, src.y, 0),
- GST_VK_IMAGE_SUBRESOURCE_LAYERS_INIT (VK_IMAGE_ASPECT_COLOR_BIT, 0, 0,
- 1), GST_VK_OFFSET3D_INIT (rslt.x, rslt.y, 0),
- GST_VK_EXTENT3D_INIT (rslt.w, rslt.h, 1));
+ /* *INDENT-OFF* */
+ region = (VkImageCopy) {
+ .srcSubresource = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .mipLevel = 0,
+ .baseArrayLayer = 0,
+ .layerCount = 1,
+ },
+ .srcOffset = { src.x, src.y, 0 },
+ .dstSubresource = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .mipLevel = 0,
+ .baseArrayLayer = 0,
+ .layerCount = 1,
+ },
+ .dstOffset = { rslt.x, rslt.y, 0 },
+ .extent = { rslt.w, rslt.h, 1 }
+ };
+ /* *INDENT-ON* */
if (!_swapper_set_image_layout_with_cmd (swapper, cmd, img_mem,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, error)) {
swapper->priv->trash_list =
gst_vulkan_trash_list_gc (swapper->priv->trash_list);
- semaphore_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
- semaphore_info.pNext = NULL;
- semaphore_info.flags = 0;
-
if (!buffer) {
g_set_error (error, GST_VULKAN_ERROR,
VK_ERROR_INITIALIZATION_FAILED, "Invalid buffer");
gst_buffer_replace (&swapper->current_buffer, buffer);
+ /* *INDENT-OFF* */
+ semaphore_info = (VkSemaphoreCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
+ .pNext = NULL,
+ .flags = 0,
+ };
+ /* *INDENT-ON* */
+
reacquire:
err = vkCreateSemaphore (swapper->device->device, &semaphore_info,
NULL, &acquire_semaphore);
goto error;
{
- VkSubmitInfo submit_info = { 0, };
VkPipelineStageFlags stages = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
+ VkSubmitInfo submit_info = { 0, };
- submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submit_info.pNext = NULL;
- submit_info.waitSemaphoreCount = 1;
- submit_info.pWaitSemaphores = &acquire_semaphore;
- submit_info.pWaitDstStageMask = &stages;
- submit_info.commandBufferCount = 1;
- submit_info.pCommandBuffers = &cmd;
- submit_info.signalSemaphoreCount = 1;
- submit_info.pSignalSemaphores = &present_semaphore;
+ /* *INDENT-OFF* */
+ submit_info = (VkSubmitInfo) {
+ .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
+ .pNext = NULL,
+ .waitSemaphoreCount = 1,
+ .pWaitSemaphores = &acquire_semaphore,
+ .pWaitDstStageMask = &stages,
+ .commandBufferCount = 1,
+ .pCommandBuffers = &cmd,
+ .signalSemaphoreCount = 1,
+ .pSignalSemaphores = &present_semaphore,
+ };
+ /* *INDENT-ON* */
fence = gst_vulkan_fence_new (swapper->device, 0, error);
if (!fence)
fence = NULL;
}
- present.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
- present.pNext = NULL;
- present.waitSemaphoreCount = 1;
- present.pWaitSemaphores = &present_semaphore;
- present.swapchainCount = 1;
- present.pSwapchains = &swapper->swap_chain;
- present.pImageIndices = &swap_idx;
- present.pResults = &present_err;
+ /* *INDENT-OFF* */
+ present = (VkPresentInfoKHR) {
+ .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
+ .pNext = NULL,
+ .waitSemaphoreCount = 1,
+ .pWaitSemaphores = &present_semaphore,
+ .swapchainCount = 1,
+ .pSwapchains = &swapper->swap_chain,
+ .pImageIndices = &swap_idx,
+ .pResults = &present_err,
+ };
+ /* *INDENT-ON* */
err = swapper->QueuePresentKHR (swapper->queue->queue, &present);
if (gst_vulkan_error_to_g_error (err, error, "vkQueuePresentKHR") < 0)
VkSubmitInfo submit_info = { 0, };
VkPipelineStageFlags stages = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
- submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submit_info.pWaitDstStageMask = &stages;
+ /* *INDENT-OFF* */
+ submit_info = (VkSubmitInfo) {
+ .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
+ .pWaitDstStageMask = &stages,
+ 0,
+ };
+ /* *INDENT-ON* */
fence = gst_vulkan_fence_new (swapper->device, 0, error);
if (!fence)
VkCommandBufferInheritanceInfo buf_inh = { 0, };
VkCommandBufferBeginInfo cmd_buf_info = { 0, };
- buf_inh.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
- buf_inh.pNext = NULL;
- buf_inh.renderPass = VK_NULL_HANDLE;
- buf_inh.subpass = 0;
- buf_inh.framebuffer = VK_NULL_HANDLE;
- buf_inh.occlusionQueryEnable = FALSE;
- buf_inh.queryFlags = 0;
- buf_inh.pipelineStatistics = 0;
-
- cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmd_buf_info.pNext = NULL;
- cmd_buf_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- cmd_buf_info.pInheritanceInfo = &buf_inh;
+ /* *INDENT-OFF* */
+ buf_inh = (VkCommandBufferInheritanceInfo) {
+ .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO,
+ .pNext = NULL,
+ .renderPass = VK_NULL_HANDLE,
+ .subpass = 0,
+ .framebuffer = VK_NULL_HANDLE,
+ .occlusionQueryEnable = FALSE,
+ .queryFlags = 0,
+ .pipelineStatistics = 0
+ };
+
+ cmd_buf_info = (VkCommandBufferBeginInfo) {
+ .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
+ .pNext = NULL,
+ .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
+ .pInheritanceInfo = &buf_inh
+ };
+ /* *INDENT-ON* */
err = vkBeginCommandBuffer (cmd, &cmd_buf_info);
if (gst_vulkan_error_to_g_error (err, &error, "vkBeginCommandBuffer") < 0)
}
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&raw->out_info); i++) {
- VkBufferImageCopy region = { 0, };
+ VkBufferImageCopy region;
GstMemory *in_mem, *out_mem;
GstVulkanBufferMemory *buf_mem;
GstVulkanImageMemory *img_mem;
}
img_mem = (GstVulkanImageMemory *) out_mem;
- GST_VK_BUFFER_IMAGE_COPY (region, 0,
- GST_VIDEO_INFO_COMP_WIDTH (&raw->in_info, i),
- GST_VIDEO_INFO_COMP_HEIGHT (&raw->in_info, i),
- GST_VK_IMAGE_SUBRESOURCE_LAYERS_INIT (VK_IMAGE_ASPECT_COLOR_BIT, 0, 0,
- 1), GST_VK_OFFSET3D_INIT (0, 0, 0),
- GST_VK_EXTENT3D_INIT (GST_VIDEO_INFO_COMP_WIDTH (&raw->out_info, i),
- GST_VIDEO_INFO_COMP_HEIGHT (&raw->out_info, i), 1));
+ /* *INDENT-OFF* */
+ region = (VkBufferImageCopy) {
+ .bufferOffset = 0,
+ .bufferRowLength = GST_VIDEO_INFO_COMP_WIDTH (&raw->in_info, i),
+ .bufferImageHeight = GST_VIDEO_INFO_COMP_HEIGHT (&raw->in_info, i),
+ .imageSubresource = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .mipLevel = 0,
+ .baseArrayLayer = 0,
+ .layerCount = 1,
+ },
+ .imageOffset = { .x = 0, .y = 0, .z = 0, },
+ .imageExtent = {
+ .width = GST_VIDEO_INFO_COMP_WIDTH (&raw->out_info, i),
+ .height = GST_VIDEO_INFO_COMP_HEIGHT (&raw->out_info, i),
+ .depth = 1,
+ }
+ };
+ /* *INDENT-ON* */
gst_vulkan_image_memory_set_layout (img_mem,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &image_memory_barrier);
VkPipelineStageFlags stages = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
GstVulkanFence *fence;
- submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submit_info.pNext = NULL;
- submit_info.waitSemaphoreCount = 0;
- submit_info.pWaitSemaphores = NULL;
- submit_info.pWaitDstStageMask = &stages;
- submit_info.commandBufferCount = 1;
- submit_info.pCommandBuffers = &cmd;
- submit_info.signalSemaphoreCount = 0;
- submit_info.pSignalSemaphores = NULL;
+ /* *INDENT-OFF* */
+ submit_info = (VkSubmitInfo) {
+ .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
+ .pNext = NULL,
+ .waitSemaphoreCount = 0,
+ .pWaitSemaphores = NULL,
+ .pWaitDstStageMask = &stages,
+ .commandBufferCount = 1,
+ .pCommandBuffers = &cmd,
+ .signalSemaphoreCount = 0,
+ .pSignalSemaphores = NULL
+ };
+ /* *INDENT-ON* */
fence = gst_vulkan_fence_new (raw->upload->device, 0, &error);
if (!fence)
static GstAllocator *_vulkan_buffer_memory_allocator;
-#define GST_VK_BUFFER_CREATE_INFO_INIT GST_VK_STRUCT_8
-#define GST_VK_BUFFER_CREATE_INFO(info, pNext, flags, size, usage, sharingMode, queueFamilyIndexCount, pQueueFamilyIndices ) \
- G_STMT_START { \
- VkBufferCreateInfo tmp = GST_VK_BUFFER_CREATE_INFO_INIT (VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, pNext, flags, size, usage, sharingMode, queueFamilyIndexCount, pQueueFamilyIndices); \
- (info) = tmp; \
- } G_STMT_END
-
static gboolean
_create_info_from_args (VkBufferCreateInfo * info, gsize size,
VkBufferUsageFlags usage)
{
/* FIXME: validate these */
- GST_VK_BUFFER_CREATE_INFO (*info, NULL, 0, size, usage,
- VK_SHARING_MODE_EXCLUSIVE, 0, NULL);
+ /* *INDENT-OFF* */
+ *info = (VkBufferCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
+ .pNext = NULL,
+ .flags = 0,
+ .size = size,
+ .usage = usage,
+ .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
+ .queueFamilyIndexCount = 0,
+ .pQueueFamilyIndices = NULL,
+ };
+ /* *INDENT-ON* */
return TRUE;
}
-#define GST_VK_BUFFER_VIEW_CREATE_INFO_INIT GST_VK_STRUCT_7
-#define GST_VK_BUFFER_VIEW_CREATE_INFO(info, pNext, flags, buffer, format, offset, range) \
- G_STMT_START { \
- VkBufferViewCreateInfo tmp = GST_VK_BUFFER_VIEW_CREATE_INFO_INIT (VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO, pNext, flags, buffer, format, offset, range); \
- (info) = tmp; \
- } G_STMT_END
-
static gboolean
_create_view_from_args (VkBufferViewCreateInfo * info, VkBuffer buffer,
VkFormat format, gsize offset, gsize range)
/* FIXME: validate these */
g_assert (format != VK_FORMAT_UNDEFINED);
- GST_VK_BUFFER_VIEW_CREATE_INFO (*info, NULL, 0, buffer, format, offset,
- range);
+ /* *INDENT-OFF* */
+ *info = (VkBufferViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO,
+ .pNext = NULL,
+ .flags = 0,
+ .buffer = buffer,
+ .format = format,
+ .offset = offset,
+ .range = range,
+ };
+ /* *INDENT-ON* */
return TRUE;
}
static void
_view_create_info (VkImage image, VkFormat format, VkImageViewCreateInfo * info)
{
- info->sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- info->pNext = NULL;
- info->image = image;
- info->format = format;
- info->viewType = VK_IMAGE_VIEW_TYPE_2D;
- info->flags = 0;
-
- GST_VK_COMPONENT_MAPPING (info->components, VK_COMPONENT_SWIZZLE_R,
- VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A);
- GST_VK_IMAGE_SUBRESOURCE_RANGE (info->subresourceRange,
- VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1);
+ /* *INDENT-OFF* */
+ *info = (VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .pNext = NULL,
+ .image = image,
+ .format = format,
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
+ .flags = 0,
+ .components = (VkComponentMapping) {
+ VK_COMPONENT_SWIZZLE_R,
+ VK_COMPONENT_SWIZZLE_G,
+ VK_COMPONENT_SWIZZLE_B,
+ VK_COMPONENT_SWIZZLE_A
+ },
+ .subresourceRange = (VkImageSubresourceRange) {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = 0,
+ .levelCount = 1,
+ .baseArrayLayer = 0,
+ .layerCount = 1,
+ }
+ };
+ /* *INDENT-ON* */
}
static gboolean
{
/* FIXME: validate these */
- info->sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
- info->pNext = NULL;
- info->flags = 0;
- info->imageType = VK_IMAGE_TYPE_2D;
- info->format = format;
- GST_VK_EXTENT3D (info->extent, width, height, 1);
- info->mipLevels = 1;
- info->arrayLayers = 1;
- info->samples = VK_SAMPLE_COUNT_1_BIT;
- info->tiling = tiling;
- info->usage = usage;
- info->sharingMode = VK_SHARING_MODE_EXCLUSIVE;
- info->queueFamilyIndexCount = 0;
- info->pQueueFamilyIndices = NULL;
- info->initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ /* *INDENT-OFF* */
+ *info = (VkImageCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
+ .pNext = NULL,
+ .flags = 0,
+ .imageType = VK_IMAGE_TYPE_2D,
+ .format = format,
+ .extent = (VkExtent3D) { width, height, 1 },
+ .mipLevels = 1,
+ .arrayLayers = 1,
+ .samples = VK_SAMPLE_COUNT_1_BIT,
+ .tiling = tiling,
+ .usage = usage,
+ .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
+ .queueFamilyIndexCount = 0,
+ .pQueueFamilyIndices = NULL,
+ .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
+ };
+ /* *INDENT-ON* */
return TRUE;
}
{
/* validate vk_mem->usage with image_layout */
- barrier->sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- barrier->pNext = NULL;
- barrier->dstAccessMask = _access_flags_from_layout (image_layout);
- barrier->srcAccessMask = _access_flags_from_layout (vk_mem->image_layout);
- barrier->oldLayout = vk_mem->image_layout;
- barrier->newLayout = image_layout;
- barrier->srcQueueFamilyIndex = 0;
- barrier->dstQueueFamilyIndex = 0;
- barrier->image = vk_mem->image;
- GST_VK_IMAGE_SUBRESOURCE_RANGE (barrier->subresourceRange,
- VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1);
+ /* *INDENT-OFF* */
+ *barrier = (VkImageMemoryBarrier) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
+ .pNext = NULL,
+ .dstAccessMask = _access_flags_from_layout (image_layout),
+ .srcAccessMask = _access_flags_from_layout (vk_mem->image_layout),
+ .oldLayout = vk_mem->image_layout,
+ .newLayout = image_layout,
+ .srcQueueFamilyIndex = 0,
+ .dstQueueFamilyIndex = 0,
+ .image = vk_mem->image,
+ .subresourceRange = (VkImageSubresourceRange) {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = 0,
+ .levelCount = 1,
+ .baseArrayLayer = 0,
+ .layerCount = 1
+ }
+ };
+ /* *INDENT-ON* */
/* FIXME: what if the barrier is never submitted or is submitted out of order? */
vk_mem->image_layout = image_layout;
VkApplicationInfo app = { 0, };
VkInstanceCreateInfo inst_info = { 0, };
- app.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
- app.pNext = NULL;
- app.pApplicationName = APP_SHORT_NAME;
- app.applicationVersion = 0;
- app.pEngineName = APP_SHORT_NAME;
- app.engineVersion = 0;
- app.apiVersion = VK_API_VERSION_1_0;
-
- inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
- inst_info.pNext = NULL;
- inst_info.pApplicationInfo = &app;
- inst_info.enabledLayerCount = 0;
- inst_info.ppEnabledLayerNames = NULL;
- inst_info.enabledExtensionCount = enabled_extension_count;
- inst_info.ppEnabledExtensionNames = (const char *const *) extension_names;
+ /* *INDENT-OFF* */
+ app = (VkApplicationInfo) {
+ .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
+ .pNext = NULL,
+ .pApplicationName = APP_SHORT_NAME,
+ .applicationVersion = 0,
+ .pEngineName = APP_SHORT_NAME,
+ .engineVersion = 0,
+ .apiVersion = VK_API_VERSION_1_0
+ };
+
+ inst_info = (VkInstanceCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
+ .pNext = NULL,
+ .pApplicationInfo = &app,
+ .enabledLayerCount = 0,
+ .ppEnabledLayerNames = NULL,
+ .enabledExtensionCount = enabled_extension_count,
+ .ppEnabledExtensionNames = (const char *const *) extension_names
+ };
+ /* *INDENT-ON* */
err = vkCreateInstance (&inst_info, NULL, &instance->instance);
if (gst_vulkan_error_to_g_error (err, error, "vkCreateInstance") < 0) {
+++ /dev/null
-/*
- * GStreamer
- * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef __GST_VULKAN_MACROS_H__
-#define __GST_VULKAN_MACROS_H__
-
-#include <gst/gst.h>
-#include <gst/vulkan/vulkan.h>
-
-G_BEGIN_DECLS
-
-#define GST_VK_STRUCT_1(a) \
- { a }
-#define GST_VK_STRUCT_2(a, b) \
- { a, b }
-#define GST_VK_STRUCT_3(a, b, c) \
- { a, b, c }
-#define GST_VK_STRUCT_4(a, b, c, d) \
- { a, b, c, d }
-#define GST_VK_STRUCT_5(a, b, c, d, e) \
- { a, b, c, d, e }
-#define GST_VK_STRUCT_6(a, b, c, d, e, f) \
- { a, b, c, d, e, f }
-#define GST_VK_STRUCT_7(a, b, c, d, e, f, g) \
- { a, b, c, d, e, f, g }
-#define GST_VK_STRUCT_8(a, b, c, d, e, f, g, h) \
- { a, b, c, d, e, f, g, h }
-
-#define GST_VK_BUFFER_IMAGE_COPY_INIT GST_VK_STRUCT_6
-#define GST_VK_BUFFER_IMAGE_COPY(info,bufferOffset_,bufferRowLength_,bufferImageHeight_,imageSubresourceLayers_,imageOffset_,imageExtent_) \
- G_STMT_START { \
- VkImageSubresourceLayers sub = imageSubresourceLayers_; \
- VkOffset3D offset = imageOffset_; \
- VkExtent3D extent = imageExtent_; \
- VkBufferImageCopy tmp = GST_VK_BUFFER_IMAGE_COPY_INIT(bufferOffset_,bufferRowLength_,bufferImageHeight_,sub,offset,extent); \
- (region) = tmp; \
- } G_STMT_END
-
-#define GST_VK_COMPONENT_MAPPING_INIT GST_VK_STRUCT_4
-#define GST_VK_COMPONENT_MAPPING(component, r_, g_, b_, a_) \
- G_STMT_START { \
- VkComponentMapping tmp = GST_VK_COMPONENT_MAPPING_INIT(r_, g_, b_, a_); \
- (component) = tmp; \
- } G_STMT_END
-
-#define GST_VK_EXTENT3D_INIT GST_VK_STRUCT_3
-#define GST_VK_EXTENT3D(extent,w,h,d) \
- G_STMT_START { \
- VkExtent3D tmp = GST_VK_EXTENT3D_INIT(w,h,d); \
- (extent) = tmp; \
- } G_STMT_END
-
-#define GST_VK_IMAGE_COPY_INIT GST_VK_STRUCT_5
-#define GST_VK_IMAGE_COPY(copy,srcSubresource_,srcOffset_,dstSubresource_,dstOffset_,extent_) \
- G_STMT_START { \
- VkImageSubresourceLayers src_res = srcSubresource_; \
- VkOffset3D src_offset = srcOffset_; \
- VkImageSubresourceLayers dst_res = dstSubresource_; \
- VkOffset3D dst_offset = dstOffset_; \
- VkExtent3D ext = extent_; \
- VkImageCopy tmp = GST_VK_IMAGE_COPY_INIT(src_res,src_offset,dst_res,dst_offset,ext); \
- (copy) = tmp; \
- } G_STMT_END
-
-#define GST_VK_IMAGE_BLIT_INIT GST_VK_STRUCT_6
-#define GST_VK_IMAGE_BLIT(blit,srcSubresource_,srcOffset_,srcExtent_,dstSubresource_,dstOffset_,dstExtent_) \
- G_STMT_START { \
- VkImageSubresourceLayers src_res = srcSubresource_; \
- VkOffset3D src_offset = srcOffset; \
- VkExtent3D src_ext = srcExtent_; \
- VkImageSubresourceLayers dst_res = dstSubresource_; \
- VkOffset3D dst_offset = dstSubresource_; \
- VkExtent3D dst_ext = dstExtent_; \
- VkImageBlit tmp = GST_VK_IMAGE_BLIT_INIT(src_res, src_offset, src_ext, dst_res, dst_offset, dst_ext); \
- (blit) = tmp; \
- } G_STMT_END
-
-#define GST_VK_IMAGE_SUBRESOURCE_INIT GST_VK_STRUCT_3
-#define GST_VK_IMAGE_SUBRESOURCE(subresource,aspectMast,mipLevel,arrayLayer) \
- G_STMT_START { \
- VkImageSubresource tmp = GST_VK_IMAGE_SUBRESOURCE_INIT(aspectMast,mipLevel,arrayLayer); \
- (subresource) = tmp; \
- } G_STMT_END
-
-#define GST_VK_IMAGE_SUBRESOURCE_LAYERS_INIT GST_VK_STRUCT_4
-#define GST_VK_IMAGE_SUBRESOURCE_LAYERS(res,aspect_,mip,base_layer,layer_count) \
- G_STMT_START { \
- VkImageSubresourceLayers tmp = GST_VK_IMAGE_SUBRESOURCE_LAYERS_INIT(aspect_,mip,base_layer,layer_count); \
- (res) = tmp; \
- } G_STMT_END
-
-#define GST_VK_IMAGE_SUBRESOURCE_RANGE_INIT GST_VK_STRUCT_5
-#define GST_VK_IMAGE_SUBRESOURCE_RANGE(range, aspect, mip_lvl, mip_lvl_count, array, layer_count) \
- G_STMT_START { \
- VkImageSubresourceRange tmp = GST_VK_IMAGE_SUBRESOURCE_RANGE_INIT(aspect,mip_lvl,mip_lvl_count,array,layer_count); \
- (range) = tmp; \
- } G_STMT_END
-
-#define GST_VK_OFFSET3D_INIT GST_VK_STRUCT_3
-#define GST_VK_OFFSET3D(offset,x_,y_,z_) \
- G_STMT_START { \
- VkOffset3D tmp = GST_VK_OFFSET3D_INIT (x_,y_,z_); \
- (offset) = tmp; \
- } G_STMT_END
-
-G_END_DECLS
-
-#endif /*__GST_VULKAN_MACROS_H__ */
#include <gst/gst.h>
#include <gst/vulkan/gstvkapi.h>
-#include <gst/vulkan/gstvkmacros.h>
#include <gst/vulkan/gstvkerror.h>
#include <gst/vulkan/gstvkinstance.h>