mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Metal: Ensure baking to binary sets minimum target OS
Co-authored-by: Travis Lange <travislange12@gmail.com>
This commit is contained in:
parent
6c9aa4c7d3
commit
b7aac81366
14 changed files with 250 additions and 44 deletions
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
RenderingShaderContainerFormat *ShaderBakerExportPluginPlatformD3D12::create_shader_container_format(const Ref<EditorExportPlatform> &p_platform) {
|
||||
RenderingShaderContainerFormat *ShaderBakerExportPluginPlatformD3D12::create_shader_container_format(const Ref<EditorExportPlatform> &p_platform, const Ref<EditorExportPreset> &p_preset) {
|
||||
if (lib_d3d12 == nullptr) {
|
||||
lib_d3d12 = LoadLibraryW(L"D3D12.dll");
|
||||
ERR_FAIL_NULL_V_MSG(lib_d3d12, nullptr, "Unable to load D3D12.dll.");
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ private:
|
|||
void *lib_d3d12 = nullptr;
|
||||
|
||||
public:
|
||||
virtual RenderingShaderContainerFormat *create_shader_container_format(const Ref<EditorExportPlatform> &p_platform) override;
|
||||
virtual RenderingShaderContainerFormat *create_shader_container_format(const Ref<EditorExportPlatform> &p_platform, const Ref<EditorExportPreset> &p_preset) override;
|
||||
virtual bool matches_driver(const String &p_driver) override;
|
||||
virtual ~ShaderBakerExportPluginPlatformD3D12() override;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,18 +32,22 @@
|
|||
|
||||
#include "drivers/metal/rendering_shader_container_metal.h"
|
||||
|
||||
RenderingShaderContainerFormat *ShaderBakerExportPluginPlatformMetal::create_shader_container_format(const Ref<EditorExportPlatform> &p_platform) {
|
||||
RenderingShaderContainerFormat *ShaderBakerExportPluginPlatformMetal::create_shader_container_format(const Ref<EditorExportPlatform> &p_platform, const Ref<EditorExportPreset> &p_preset) {
|
||||
const String &os_name = p_platform->get_os_name();
|
||||
const MetalDeviceProfile *profile;
|
||||
String min_os_version;
|
||||
|
||||
if (os_name == U"macOS") {
|
||||
profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::macOS, MetalDeviceProfile::GPU::Apple7);
|
||||
// Godot metal doesn't support x86_64 mac so no need to worry about that version
|
||||
min_os_version = p_preset->get("application/min_macos_version_arm64");
|
||||
} else if (os_name == U"iOS") {
|
||||
profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::iOS, MetalDeviceProfile::GPU::Apple7);
|
||||
min_os_version = p_preset->get("application/min_ios_version");
|
||||
} else {
|
||||
ERR_FAIL_V_MSG(nullptr, vformat("Unsupported platform: %s", os_name));
|
||||
}
|
||||
return memnew(RenderingShaderContainerFormatMetal(profile, true));
|
||||
return memnew(RenderingShaderContainerFormatMetal(profile, true, min_os_version));
|
||||
}
|
||||
|
||||
bool ShaderBakerExportPluginPlatformMetal::matches_driver(const String &p_driver) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@
|
|||
|
||||
class ShaderBakerExportPluginPlatformMetal : public ShaderBakerExportPluginPlatform {
|
||||
public:
|
||||
virtual RenderingShaderContainerFormat *create_shader_container_format(const Ref<EditorExportPlatform> &p_platform) override;
|
||||
virtual RenderingShaderContainerFormat *create_shader_container_format(const Ref<EditorExportPlatform> &p_platform, const Ref<EditorExportPreset> &p_preset) override;
|
||||
virtual bool matches_driver(const String &p_driver) override;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "drivers/vulkan/rendering_shader_container_vulkan.h"
|
||||
|
||||
RenderingShaderContainerFormat *ShaderBakerExportPluginPlatformVulkan::create_shader_container_format(const Ref<EditorExportPlatform> &p_platform) {
|
||||
RenderingShaderContainerFormat *ShaderBakerExportPluginPlatformVulkan::create_shader_container_format(const Ref<EditorExportPlatform> &p_platform, const Ref<EditorExportPreset> &p_preset) {
|
||||
return memnew(RenderingShaderContainerFormatVulkan);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,6 @@ class ShaderBakerExportPluginPlatformVulkan : public ShaderBakerExportPluginPlat
|
|||
GDCLASS(ShaderBakerExportPluginPlatformVulkan, ShaderBakerExportPluginPlatform);
|
||||
|
||||
public:
|
||||
virtual RenderingShaderContainerFormat *create_shader_container_format(const Ref<EditorExportPlatform> &p_platform) override;
|
||||
virtual RenderingShaderContainerFormat *create_shader_container_format(const Ref<EditorExportPlatform> &p_platform, const Ref<EditorExportPreset> &p_preset) override;
|
||||
virtual bool matches_driver(const String &p_driver) override;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue