diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2024-08-23 08:45:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 08:45:13 +0200 |
commit | a1acd38c35781181cde726b039eb8a9a0b6aa79f (patch) | |
tree | a59ed2c336ba1e78ad79755ef2386958ab20babf | |
parent | 568589c9d8c763bfb3a4348174d53b42d7c59f21 (diff) | |
parent | bbc7962fe21fb4632b7ec0d49091f5263c3e3d60 (diff) | |
download | redot-engine-a1acd38c35781181cde726b039eb8a9a0b6aa79f.tar.gz |
Merge pull request #95945 from stuartcarnie/sgc/metal_mobile_fix
Metal: Fix artefacts for mobile render method and disable multi-view
-rw-r--r-- | drivers/metal/rendering_device_driver_metal.mm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/metal/rendering_device_driver_metal.mm b/drivers/metal/rendering_device_driver_metal.mm index 0a9fde06a7..ffa4cf92c7 100644 --- a/drivers/metal/rendering_device_driver_metal.mm +++ b/drivers/metal/rendering_device_driver_metal.mm @@ -3091,12 +3091,22 @@ RenderingDeviceDriverMetal::Result<id<MTLFunction>> RenderingDeviceDriverMetal:: }]; } + // Initialize an array of integers representing the indexes of p_specialization_constants + uint32_t *indexes = (uint32_t *)alloca(p_specialization_constants.size() * sizeof(uint32_t)); + for (uint32_t i = 0; i < p_specialization_constants.size(); i++) { + indexes[i] = i; + } + // Sort the array of integers based on the values in p_specialization_constants + std::sort(indexes, &indexes[p_specialization_constants.size()], [&](int a, int b) { + return p_specialization_constants[a].constant_id < p_specialization_constants[b].constant_id; + }); + MTLFunctionConstantValues *constantValues = [MTLFunctionConstantValues new]; uint32_t i = 0; uint32_t j = 0; while (i < constants.count && j < p_specialization_constants.size()) { MTLFunctionConstant *curr = constants[i]; - PipelineSpecializationConstant const &sc = p_specialization_constants[j]; + PipelineSpecializationConstant const &sc = p_specialization_constants[indexes[j]]; if (curr.index == sc.constant_id) { switch (curr.type) { case MTLDataTypeBool: @@ -3769,7 +3779,7 @@ uint64_t RenderingDeviceDriverMetal::api_trait_get(ApiTrait p_trait) { bool RenderingDeviceDriverMetal::has_feature(Features p_feature) { switch (p_feature) { case SUPPORTS_MULTIVIEW: - return true; + return false; case SUPPORTS_FSR_HALF_FLOAT: return true; case SUPPORTS_ATTACHMENT_VRS: |