Merge pull request #267 from aws-lumberyard-dev/LYN-2784

LYN-2784: Enable Vulkan RHI to build on Linux
This commit is contained in:
Steve Pham
2021-04-23 17:37:17 -07:00
committed by GitHub
13 changed files with 131 additions and 6 deletions
@@ -0,0 +1,14 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(GLAD_VULKAN_COMPILE_DEFINITIONS
VK_USE_PLATFORM_XCB_KHR
)
+1 -1
View File
@@ -188,11 +188,11 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS)
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
Gem::Atom_RHI.Edit
Gem::Atom_RHI.Reflect
Gem::Atom_RHI.Public
Gem::Atom_RHI_Vulkan.Reflect
Gem::Atom_RHI_Vulkan.Builders.Static
Gem::Atom_RHI.Edit
)
endif()
@@ -10,3 +10,6 @@
*
*/
#pragma once
#include <xcb/xcb.h>
#include <xcb/xcbext.h>
@@ -0,0 +1,21 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/base.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/std/algorithm.h>
#include <vulkan/vulkan.h>
#include <limits.h>
#include <RHI/Vulkan.h>
#define AZ_VULKAN_SURFACE_EXTENSION_NAME VK_KHR_XCB_SURFACE_EXTENSION_NAME
@@ -11,4 +11,5 @@
*/
#pragma once
#include <Atom_RHI_Vulkan_precompiled_Linux.h>
@@ -9,4 +9,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(PAL_TRAIT_ATOM_RHI_VULKAN_SUPPORTED FALSE)
set(PAL_TRAIT_ATOM_RHI_VULKAN_SUPPORTED TRUE)
@@ -0,0 +1,51 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <Atom/RHI.Reflect/Vulkan/ReflectSystemComponent.h>
#include <Atom/RHI.Reflect/ReflectSystemComponent.h>
#include <AzCore/Module/Module.h>
#include <RHI.Builders/ShaderPlatformInterfaceSystemComponent.h>
namespace AZ
{
namespace Vulkan
{
//! Exposes Vulkan RHI Building components to the Asset Processor.
class BuilderModule final
: public AZ::Module
{
public:
AZ_RTTI(BuilderModule, "{C22CF1CB-59AA-4247-A983-BC371A7B0513}", AZ::Module);
BuilderModule()
{
m_descriptors.insert(m_descriptors.end(), {
ShaderPlatformInterfaceSystemComponent::CreateDescriptor()
});
}
AZ::ComponentTypeList GetRequiredSystemComponents() const override
{
return
{
azrtti_typeid<ShaderPlatformInterfaceSystemComponent>(),
};
}
};
} // namespace Vulkan
} // namespace AZ
// DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
// The first parameter should be GemName_GemIdLower
// The second should be the fully qualified name of the class above
AZ_DECLARE_MODULE_CLASS(Gem_Atom_RHI_Vulkan_Builders, AZ::Vulkan::BuilderModule);
@@ -0,0 +1,36 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "Atom_RHI_Vulkan_precompiled.h"
#include <RHI/Conversion.h>
#include <RHI/Instance.h>
#include <RHI/WSISurface.h>
namespace AZ
{
namespace Vulkan
{
RHI::ResultCode WSISurface::BuildNativeSurface()
{
Instance& instance = Instance::GetInstance();
VkXcbSurfaceCreateInfoKHR createInfo{};
createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.window = static_cast<xcb_window_t>(m_descriptor.m_windowHandle.GetIndex());
const VkResult result = vkCreateXcbSurfaceKHR(instance.GetNativeInstance(), &createInfo, nullptr, &m_nativeSurface);
AssertSuccess(result);
return ConvertResult(result);
}
}
}
@@ -11,7 +11,7 @@
*/
#pragma once
#define AZ_TRAIT_ATOM_SHADERBUILDER_DXC "Builders/DirectXShaderCompilerAz/dxc.exe"
#define AZ_TRAIT_ATOM_SHADERBUILDER_DXC "Builders/DirectXShaderCompilerAz/bin/dxc"
#define AZ_TRAIT_ATOM_VULKAN_DISABLE_DUAL_SOURCE_BLENDING 0
#define AZ_TRAIT_ATOM_VULKAN_DLL ""
#define AZ_TRAIT_ATOM_VULKAN_DLL_1 ""
@@ -10,4 +10,5 @@
#
set(FILES
RHI.Builders/BuilderModule_Linux.cpp
)
@@ -10,5 +10,4 @@
#
set(FILES
../Common/Unimplemented/Empty_Unimplemented.cpp
)
@@ -10,7 +10,7 @@
#
set(FILES
../Common/Unimplemented/ModuleStub_Unimplemented.cpp
RHI/WSISurface_Linux.cpp
Vulkan_Traits_Linux.h
Vulkan_Traits_Platform.h
)
@@ -10,5 +10,4 @@
#
set(FILES
../Common/Unimplemented/Empty_Unimplemented.cpp
)