Commit 71c49f8e by Antonio Maiorano

Run clang-format on renamed headers

Our script, src/clang-format-all.sh, applies only to .hpp, not .h files. Ran it again after renaming the Vulkan-source .h to .hpp. Bug: b/144825072 Change-Id: I2c6d11ec2285567155f207830bdf560431b927f4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44390 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 42fd159c
......@@ -24,6 +24,8 @@
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(PATCH_VERSION)
#define VERSION_STRING \
MACRO_STRINGIFY(MAJOR_VERSION) \
"." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(PATCH_VERSION)
#endif // Version_h
#endif // Version_h
......@@ -23,15 +23,15 @@ namespace vk {
// Note: Constant array initialization requires a string literal.
// constexpr char* or char[] does not work for that purpose.
#define SWIFTSHADER_DEVICE_NAME "SwiftShader Device" // Max length: VK_MAX_PHYSICAL_DEVICE_NAME_SIZE
#define SWIFTSHADER_UUID "SwiftShaderUUID" // Max length: VK_UUID_SIZE (16)
#define SWIFTSHADER_DEVICE_NAME "SwiftShader Device" // Max length: VK_MAX_PHYSICAL_DEVICE_NAME_SIZE
#define SWIFTSHADER_UUID "SwiftShaderUUID" // Max length: VK_UUID_SIZE (16)
enum
{
API_VERSION = VK_API_VERSION_1_1,
DRIVER_VERSION = VK_MAKE_VERSION(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION),
VENDOR_ID = 0x1AE0, // Google, Inc.: https://pcisig.com/google-inc-1
DEVICE_ID = 0xC0DE, // SwiftShader (placeholder)
VENDOR_ID = 0x1AE0, // Google, Inc.: https://pcisig.com/google-inc-1
DEVICE_ID = 0xC0DE, // SwiftShader (placeholder)
};
enum
......@@ -43,7 +43,7 @@ enum
MIN_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 256,
MIN_STORAGE_BUFFER_OFFSET_ALIGNMENT = 256,
MEMORY_TYPE_GENERIC_BIT = 0x1, // Generic system memory.
MEMORY_TYPE_GENERIC_BIT = 0x1, // Generic system memory.
};
enum
......@@ -68,8 +68,8 @@ enum
MAX_DESCRIPTOR_SET_UNIFORM_BUFFERS_DYNAMIC = 8,
MAX_DESCRIPTOR_SET_STORAGE_BUFFERS_DYNAMIC = 4,
MAX_DESCRIPTOR_SET_COMBINED_BUFFERS_DYNAMIC =
MAX_DESCRIPTOR_SET_UNIFORM_BUFFERS_DYNAMIC +
MAX_DESCRIPTOR_SET_STORAGE_BUFFERS_DYNAMIC,
MAX_DESCRIPTOR_SET_UNIFORM_BUFFERS_DYNAMIC +
MAX_DESCRIPTOR_SET_STORAGE_BUFFERS_DYNAMIC,
};
enum
......@@ -84,8 +84,8 @@ constexpr int SUBPIXEL_PRECISION_MASK = 0xFFFFFFFF >> (32 - SUBPIXEL_PRECISION_B
} // namespace vk
#if defined(__linux__) || defined(__ANDROID__)
#define SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD 1
#define SWIFTSHADER_EXTERNAL_SEMAPHORE_OPAQUE_FD 1
# define SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD 1
# define SWIFTSHADER_EXTERNAL_SEMAPHORE_OPAQUE_FD 1
#endif
constexpr VkDeviceSize MAX_MEMORY_ALLOCATION_SIZE = 0x40000000ull; // 0x40000000 = 1 GiB
......@@ -94,4 +94,4 @@ constexpr VkDeviceSize MAX_MEMORY_ALLOCATION_SIZE = 0x40000000ull; // 0x4000000
// Signed arithmetic further restricts it to 2 GiB.
static_assert(MAX_MEMORY_ALLOCATION_SIZE <= 0x80000000ull, "maxMemoryAllocationSize must not exceed 2 GiB");
#endif // VK_CONFIG_HPP_
#endif // VK_CONFIG_HPP_
......@@ -24,16 +24,16 @@
#include "VkImage.hpp"
#include "VkImageView.hpp"
#include "VkInstance.hpp"
#include "VkPhysicalDevice.hpp"
#include "VkPipeline.hpp"
#include "VkPipelineCache.hpp"
#include "VkPipelineLayout.hpp"
#include "VkPhysicalDevice.hpp"
#include "VkQueryPool.hpp"
#include "VkQueue.hpp"
#include "VkRenderPass.hpp"
#include "VkSampler.hpp"
#include "VkSemaphore.hpp"
#include "VkShaderModule.hpp"
#include "VkRenderPass.hpp"
#include "WSI/VkSurfaceKHR.hpp"
#include "WSI/VkSwapchainKHR.hpp"
......@@ -50,7 +50,7 @@ namespace vk {
// destructor prior to releasing the object (by default,
// VkObjectBase::destroy does nothing).
template<typename VkT>
inline void destroy(VkT vkObject, const VkAllocationCallbacks* pAllocator)
inline void destroy(VkT vkObject, const VkAllocationCallbacks *pAllocator)
{
auto object = Cast(vkObject);
if(object)
......
......@@ -22,8 +22,8 @@ namespace vk {
class Device;
class Instance;
PFN_vkVoidFunction GetInstanceProcAddr(Instance* instance, const char* pName);
PFN_vkVoidFunction GetDeviceProcAddr(Device* device, const char* pName);
PFN_vkVoidFunction GetInstanceProcAddr(Instance *instance, const char *pName);
PFN_vkVoidFunction GetDeviceProcAddr(Device *device, const char *pName);
} // namespace vk
......@@ -32,11 +32,11 @@ PFN_vkVoidFunction GetDeviceProcAddr(Device* device, const char* pName);
// about this global pointer. Since this is a private implementation detail
// between the Vulkan loader and the ICDs, this type will never be part of
// the <vulkan/vulkan_fuchsia.h> headers, so define the type here.
typedef VkResult(VKAPI_PTR* PFN_vkConnectToService)(const char* pName, uint32_t handle);
typedef VkResult(VKAPI_PTR *PFN_vkConnectToService)(const char *pName, uint32_t handle);
namespace vk {
extern PFN_vkConnectToService icdFuchsiaServiceConnectCallback;
}
#endif // VK_USE_PLATFORM_FUCHSIA
#endif // VK_UTILS_HPP_
#endif // VK_UTILS_HPP_
......@@ -19,16 +19,16 @@
namespace vk {
void* allocate(size_t count, size_t alignment, const VkAllocationCallbacks* pAllocator,
void *allocate(size_t count, size_t alignment, const VkAllocationCallbacks *pAllocator,
VkSystemAllocationScope allocationScope = VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
void deallocate(void* ptr, const VkAllocationCallbacks* pAllocator);
void deallocate(void *ptr, const VkAllocationCallbacks *pAllocator);
template <typename T>
T* allocate(size_t count, const VkAllocationCallbacks* pAllocator)
template<typename T>
T *allocate(size_t count, const VkAllocationCallbacks *pAllocator)
{
return static_cast<T*>(allocate(count, alignof(T), pAllocator, T::GetAllocationScope()));
return static_cast<T *>(allocate(count, alignof(T), pAllocator, T::GetAllocationScope()));
}
} // namespace vk
#endif // VK_MEMORY_HPP_
#endif // VK_MEMORY_HPP_
......@@ -19,10 +19,11 @@
#include <cstdint>
#include <type_traits>
template<typename T> class VkNonDispatchableHandle
template<typename T>
class VkNonDispatchableHandle
{
public:
operator void*() const
operator void *() const
{
static_assert(sizeof(VkNonDispatchableHandle) == sizeof(uint64_t), "Size is not 64 bits!");
......@@ -32,7 +33,7 @@ public:
static_assert(std::is_trivial<VkNonDispatchableHandle<T>>::value, "VkNonDispatchableHandle<T> is not trivial!");
static_assert(std::is_standard_layout<VkNonDispatchableHandle<T>>::value, "VkNonDispatchableHandle<T> is not standard layout!");
return reinterpret_cast<void*>(static_cast<uintptr_t>(handle));
return reinterpret_cast<void *>(static_cast<uintptr_t>(handle));
}
void operator=(uint64_t h)
......@@ -43,17 +44,17 @@ public:
uint64_t handle;
};
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) \
typedef struct object##_T *object##Ptr; \
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) \
typedef struct object##_T *object##Ptr; \
typedef VkNonDispatchableHandle<object##Ptr> object; \
template class VkNonDispatchableHandle<object##Ptr>;
#include <vulkan/vulkan.h>
#include <vulkan/vk_ext_provoking_vertex.h>
#include <vulkan/vulkan.h>
#ifdef Bool
#undef Bool // b/127920555
#undef None
# undef Bool // b/127920555
# undef None
#endif
#endif // VULKAN_PLATFORM
#endif // VULKAN_PLATFORM
......@@ -15,8 +15,8 @@
#ifndef SWIFTSHADER_METALSURFACE_HPP
#define SWIFTSHADER_METALSURFACE_HPP
#include "Vulkan/VkObject.hpp"
#include "VkSurfaceKHR.hpp"
#include "Vulkan/VkObject.hpp"
#ifdef VK_USE_PLATFORM_MACOS_MVK
# include "vulkan/vulkan_macos.h"
#endif
......@@ -28,37 +28,40 @@ namespace vk {
class MetalLayer;
class MetalSurface : public SurfaceKHR {
class MetalSurface : public SurfaceKHR
{
public:
MetalSurface(const void *pCreateInfo, void *mem);
MetalSurface(const void *pCreateInfo, void *mem);
void destroySurface(const VkAllocationCallbacks *pAllocator) override;
void destroySurface(const VkAllocationCallbacks *pAllocator) override;
static size_t ComputeRequiredAllocationSize(const void *pCreateInfo);
static size_t ComputeRequiredAllocationSize(const void *pCreateInfo);
void getSurfaceCapabilities(VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) const override;
void getSurfaceCapabilities(VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) const override;
virtual void attachImage(PresentImage* image) override {}
virtual void detachImage(PresentImage* image) override {}
VkResult present(PresentImage* image) override;
virtual void attachImage(PresentImage *image) override {}
virtual void detachImage(PresentImage *image) override {}
VkResult present(PresentImage *image) override;
protected:
MetalLayer* metalLayer = nullptr;
MetalLayer *metalLayer = nullptr;
};
#ifdef VK_USE_PLATFORM_METAL_EXT
class MetalSurfaceEXT : public MetalSurface, public ObjectBase<MetalSurfaceEXT, VkSurfaceKHR> {
class MetalSurfaceEXT : public MetalSurface, public ObjectBase<MetalSurfaceEXT, VkSurfaceKHR>
{
public:
MetalSurfaceEXT(const VkMetalSurfaceCreateInfoEXT *pCreateInfo, void *mem);
MetalSurfaceEXT(const VkMetalSurfaceCreateInfoEXT *pCreateInfo, void *mem);
};
#endif
#ifdef VK_USE_PLATFORM_MACOS_MVK
class MacOSSurfaceMVK : public MetalSurface, public ObjectBase<MacOSSurfaceMVK, VkSurfaceKHR> {
class MacOSSurfaceMVK : public MetalSurface, public ObjectBase<MacOSSurfaceMVK, VkSurfaceKHR>
{
public:
MacOSSurfaceMVK(const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, void *mem);
MacOSSurfaceMVK(const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, void *mem);
};
#endif
}
#endif //SWIFTSHADER_METALSURFACE_HPP
} // namespace vk
#endif //SWIFTSHADER_METALSURFACE_HPP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment