PrecompiledShaderBuilder.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AssetBuilderSDK/AssetBuilderBusses.h>
  10. namespace AZ
  11. {
  12. class SerializeContext;
  13. //! AssetBuilder that takes precompiled azshader product file and produces an output
  14. //! products with the correct dependent asset GUIDs.
  15. class PrecompiledShaderBuilder final
  16. : public AssetBuilderSDK::AssetBuilderCommandBus::Handler
  17. {
  18. public:
  19. AZ_TYPE_INFO(PrecompiledShaderBuilder, "{50D3185B-489C-4C8E-84DC-F99A75FDB72F}");
  20. static constexpr const char* Extension = "precompiledshader";
  21. PrecompiledShaderBuilder() = default;
  22. ~PrecompiledShaderBuilder() = default;
  23. // Asset Builder Callback Functions
  24. void CreateJobs(const AssetBuilderSDK::CreateJobsRequest& request, AssetBuilderSDK::CreateJobsResponse& response) const;
  25. void ProcessJob(const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response) const;
  26. // AssetBuilderSDK::AssetBuilderCommandBus interface
  27. void ShutDown() override;
  28. /// Register to builder and listen to builder command
  29. void RegisterBuilder();
  30. private:
  31. template<typename T>
  32. T* LoadSourceAsset(SerializeContext* context, const AZStd::string& shaderAssetPath) const;
  33. bool m_isShuttingDown = false;
  34. };
  35. } // namespace AZ