Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metal: Fix artifacts for mobile render method and disable multi-view #95945

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions drivers/metal/rendering_device_driver_metal.mm
Original file line number Diff line number Diff line change
@@ -3091,12 +3091,22 @@ bool isArrayTexture(MTLTextureType p_type) {
}];
}

// 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 @@ bool isArrayTexture(MTLTextureType p_type) {
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:
Loading