Skip to content

Commit b89c47b

Browse files
committed
Merge pull request #106925 from stuartcarnie/metal_fix_multiview
Metal: Fix multi-view support
2 parents 7cc0e63 + 06ebcc9 commit b89c47b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

servers/rendering/rendering_device_commons.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ Error RenderingDeviceCommons::reflect_spirv(VectorView<ShaderStageSPIRVData> p_s
12101210
}
12111211
}
12121212

1213-
if (stage == SHADER_STAGE_VERTEX) {
1213+
if (stage == SHADER_STAGE_VERTEX || stage == SHADER_STAGE_FRAGMENT) {
12141214
uint32_t iv_count = 0;
12151215
result = spvReflectEnumerateInputVariables(&module, &iv_count, nullptr);
12161216
ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, FAILED,
@@ -1228,10 +1228,12 @@ Error RenderingDeviceCommons::reflect_spirv(VectorView<ShaderStageSPIRVData> p_s
12281228
if (!v) {
12291229
continue;
12301230
}
1231-
if (v->decoration_flags == 0) { // Regular input.
1232-
r_reflection.vertex_input_mask |= (((uint64_t)1) << v->location);
1231+
if (stage == SHADER_STAGE_VERTEX) {
1232+
if (v->decoration_flags == 0) { // Regular input.
1233+
r_reflection.vertex_input_mask |= (((uint64_t)1) << v->location);
1234+
}
12331235
}
1234-
if (v->built_in == SpvBuiltInViewIndex || v->built_in == SpvBuiltInViewportIndex) {
1236+
if (v->built_in == SpvBuiltInViewIndex) {
12351237
r_reflection.has_multiview = true;
12361238
}
12371239
}
@@ -1259,9 +1261,6 @@ Error RenderingDeviceCommons::reflect_spirv(VectorView<ShaderStageSPIRVData> p_s
12591261
if (refvar->built_in != SpvBuiltInFragDepth) {
12601262
r_reflection.fragment_output_mask |= 1 << refvar->location;
12611263
}
1262-
if (refvar->built_in == SpvBuiltInViewIndex || refvar->built_in == SpvBuiltInViewportIndex) {
1263-
r_reflection.has_multiview = true;
1264-
}
12651264
}
12661265
}
12671266
}

0 commit comments

Comments
 (0)