* Remove unused Vulkan ShaderDescriptor class.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Add missing dependency on Gem::Atom_RHI.Public

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Revert changes made to Gems/Atom/RHI/Vulkan/Code/* in https://github.com/o3de/o3de/pull/4021, and instead just check a trait to determine whether the RHI Vulkan targets have been defined else where. Gems/Atom/RHI/Vulkan/Code/CMakeLists.txt maybe needs to be revisited at some point, but my changes are causing numerous issues on mac so this just restores the prior behavior for all platforms while also providing a mechanism for any platform to simply define exactly what Vulkan related targets it needs independently.

Signed-off-by: bosnichd <bosnichd@amazon.com>
This commit is contained in:
bosnichd
2021-09-10 13:12:45 -06:00
committed by GitHub
parent 43355e47ca
commit 141cb55903
6 changed files with 6 additions and 132 deletions
+5 -4
View File
@@ -9,7 +9,11 @@
ly_get_list_relative_pal_filename(pal_include_dir ${CMAKE_CURRENT_LIST_DIR}/Include/Platform/${PAL_PLATFORM_NAME})
ly_get_list_relative_pal_filename(pal_source_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/${PAL_PLATFORM_NAME})
include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) # PAL_TRAIT_ATOM_RHI_VULKAN_SUPPORTED
include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) # PAL_TRAIT_ATOM_RHI_VULKAN_SUPPORTED / PAL_TRAIT_ATOM_RHI_VULKAN_TARGETS_ALREADY_DEFINED
if(PAL_TRAIT_ATOM_RHI_VULKAN_TARGETS_ALREADY_DEFINED)
return() # Vulkan targets already defined in PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
endif()
if(NOT PAL_TRAIT_ATOM_RHI_VULKAN_SUPPORTED)
@@ -19,12 +23,9 @@ if(NOT PAL_TRAIT_ATOM_RHI_VULKAN_SUPPORTED)
NAMESPACE Gem
FILES_CMAKE
atom_rhi_vulkan_stub_module.cmake
atom_rhi_vulkan_reflect_common_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
Include
Source
${pal_include_dir}
Include/Atom/RHI.Loader/Glad
BUILD_DEPENDENCIES
PRIVATE
@@ -1,57 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/containers/array.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <Atom/RHI.Reflect/ShaderStages.h>
#include <Atom/RHI/Object.h>
namespace AZ
{
class ReflectContext;
namespace Vulkan
{
using ShaderByteCode = AZStd::vector<uint8_t>;
// TODO: remove this class after checking it is no longer necessary.
class ShaderDescriptor final
: public RHI::Object
{
using Base = RHI::Object;
public:
AZ_CLASS_ALLOCATOR(ShaderDescriptor, AZ::SystemAllocator, 0);
AZ_RTTI(ShaderDescriptor, "EB289A24-52DF-45E5-B3D0-C33B6DBAAAA7", Base);
static void Reflect(AZ::ReflectContext* context);
/// Clears all bytecodes and resets descriptor
void Clear();
/// Finalizes the descriptor and builds the hash value.
void Finalize();
/// Assigns bytecode to a specific shader stage.
void SetByteCode(RHI::ShaderStage shaderStage, const ShaderByteCode& bytecode);
/// Returns whether bytecode exists for the given shader stage.
bool HasByteCode(RHI::ShaderStage shaderStage) const;
/// Returns the bytecode for the given shader stage.
const ShaderByteCode& GetByteCode(RHI::ShaderStage shaderStage) const;
private:
/// The set of shader bytecodes indexed by shader stage.
AZStd::array<ShaderByteCode, static_cast<size_t>(RHI::ShaderStage::GraphicsCount)> m_byteCodesByStage;
size_t m_hash = 0;
};
}
}
@@ -5,8 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <Atom/RHI.Reflect/Vulkan/ReflectSystemComponent.h>
#include <AzCore/Module/Module.h>
namespace AZ
@@ -19,12 +17,7 @@ namespace AZ
public:
AZ_RTTI(PlatformModule, "{958CB096-796C-42C7-9B29-17C6FE792C30}", Module);
PlatformModule()
{
m_descriptors.insert(m_descriptors.end(), {
ReflectSystemComponent::CreateDescriptor()
});
}
PlatformModule() = default;
~PlatformModule() override = default;
AZ::ComponentTypeList GetRequiredSystemComponents() const override
@@ -1,59 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <Atom/RHI.Reflect/Vulkan/ShaderDescriptor.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AZ
{
namespace Vulkan
{
void ShaderDescriptor::Reflect(AZ::ReflectContext* context)
{
if (SerializeContext* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<ShaderDescriptor, Base>()
->Version(1)
->Field("m_byteCodesByStage", &ShaderDescriptor::m_byteCodesByStage);
}
}
void ShaderDescriptor::Clear()
{
m_hash = 0;
m_byteCodesByStage.fill(ShaderByteCode());
}
void ShaderDescriptor::Finalize()
{
AZ::Crc32 crc;
for (const ShaderByteCode& byteCode : m_byteCodesByStage)
{
if (!byteCode.empty())
{
crc.Add(byteCode.data(), byteCode.size());
}
}
m_hash = crc;
}
void ShaderDescriptor::SetByteCode(RHI::ShaderStage shaderStage, const ShaderByteCode& bytecode)
{
m_byteCodesByStage[static_cast<uint32_t>(shaderStage)] = bytecode;
}
bool ShaderDescriptor::HasByteCode(RHI::ShaderStage shaderStage) const
{
return !(m_byteCodesByStage[static_cast<uint32_t>(shaderStage)].empty());
}
const ShaderByteCode& ShaderDescriptor::GetByteCode(RHI::ShaderStage shaderStage) const
{
return m_byteCodesByStage[static_cast<uint32_t>(shaderStage)];
}
}
}
@@ -9,8 +9,6 @@
#include <Atom/RHI/DeviceObject.h>
#include <AzCore/Memory/PoolAllocator.h>
#include <Atom/RHI.Reflect/Vulkan/ShaderDescriptor.h>
#include <Atom/RHI.Reflect/Vulkan/ShaderDescriptor.h>
#include <Atom/RHI.Reflect/Vulkan/ShaderStageFunction.h>
namespace AZ
@@ -11,8 +11,6 @@ set(FILES
Include/Atom/RHI.Reflect/Vulkan/BufferPoolDescriptor.h
Source/RHI.Reflect/ImagePoolDescriptor.cpp
Include/Atom/RHI.Reflect/Vulkan/ImagePoolDescriptor.h
Source/RHI.Reflect/ShaderDescriptor.cpp
Include/Atom/RHI.Reflect/Vulkan/ShaderDescriptor.h
Source/RHI.Reflect/ShaderStageFunction.cpp
Include/Atom/RHI.Reflect/Vulkan/ShaderStageFunction.h
Source/RHI.Reflect/ReflectSystemComponent.cpp