Skip to content

Commit

Permalink
Replace vulkan.h includes with vulkan_core.h
Browse files Browse the repository at this point in the history
vulkan_core.h only includes 'core' Vulkan declarations, while vulkan.h
consists of vulkan_core.h plus platform-specific headers.

Only Window System Integration (WSI) and closely related source files
should have a need to include vulkan.h. Everything else, in particular
our back-end, should not require anything Vulkan platform-specific.

This avoids issues such as Xlib defining global macros which clash with
C++ type and variable names.

Bug b/124265819

Change-Id: I6c250f27aef39b98a2a8b677c169df060698f104
Reviewed-on: https://swiftshader-review.googlesource.com/c/24709
Tested-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
  • Loading branch information
c0d1f1ed committed Feb 13, 2019
1 parent 73c3124 commit de16f32
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/Device/Surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "Color.hpp"
#include "Device/Config.hpp"
#include "System/Resource.hpp"
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>

namespace sw
{
Expand Down
2 changes: 1 addition & 1 deletion src/Vulkan/VkGetProcAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef VK_UTILS_HPP_
#define VK_UTILS_HPP_

#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>

namespace vk
{
Expand Down
2 changes: 1 addition & 1 deletion src/Vulkan/VkMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef VK_MEMORY_HPP_
#define VK_MEMORY_HPP_

#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>

namespace vk
{
Expand Down
3 changes: 2 additions & 1 deletion src/Vulkan/VkObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#include "VkConfig.h"
#include "VkDebug.hpp"
#include "VkMemory.h"
#include <vulkan/vulkan.h>

#include <vulkan/vulkan_core.h>
#include <vulkan/vk_icd.h>

namespace vk
Expand Down
2 changes: 1 addition & 1 deletion src/Vulkan/VkPromotedExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// VK_KHR_storage_buffer_storage_class (no functions in this extension)
// VK_KHR_variable_pointers (no functions in this extension)

#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>

extern "C"
{
Expand Down
42 changes: 21 additions & 21 deletions src/Vulkan/libVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,22 +467,22 @@ VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount
return VK_SUCCESS;
}

VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
{
TRACE("(VkQueue queue = 0x%X)", queue);

vk::Cast(queue)->waitIdle();

return VK_SUCCESS;
}

VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device)
{
TRACE("(VkDevice device = 0x%X)", device);

vk::Cast(device)->waitIdle();

return VK_SUCCESS;
VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
{
TRACE("(VkQueue queue = 0x%X)", queue);

vk::Cast(queue)->waitIdle();

return VK_SUCCESS;
}

VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device)
{
TRACE("(VkDevice device = 0x%X)", device);

vk::Cast(device)->waitIdle();

return VK_SUCCESS;
}

VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
Expand Down Expand Up @@ -1209,8 +1209,8 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool c

VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
{
TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolResetFlags flags = %d )",
device, commandPool, flags);
TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolResetFlags flags = %d )",
device, commandPool, flags);

return vk::Cast(commandPool)->reset(flags);
}
Expand Down Expand Up @@ -1923,9 +1923,9 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhy

VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
{
TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolTrimFlags flags = %d)",
device, commandPool, flags);

TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolTrimFlags flags = %d)",
device, commandPool, flags);

vk::Cast(commandPool)->trim(flags);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/VulkanUnitTests/unittests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "gtest/gtest.h"
#include "gmock/gmock.h"

#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
#include <vulkan/vk_icd.h>

#include <cstring>
Expand Down

0 comments on commit de16f32

Please sign in to comment.