Merge pull request #106925 from stuartcarnie/metal_fix_multiview

Metal: Fix multi-view support
This commit is contained in:
Rémi Verschelde 2025-05-29 09:45:40 +02:00
commit b89c47bb85
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1210,7 +1210,7 @@ Error RenderingDeviceCommons::reflect_spirv(VectorView<ShaderStageSPIRVData> p_s
}
}
if (stage == SHADER_STAGE_VERTEX) {
if (stage == SHADER_STAGE_VERTEX || stage == SHADER_STAGE_FRAGMENT) {
uint32_t iv_count = 0;
result = spvReflectEnumerateInputVariables(&module, &iv_count, nullptr);
ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, FAILED,
@ -1228,10 +1228,12 @@ Error RenderingDeviceCommons::reflect_spirv(VectorView<ShaderStageSPIRVData> p_s
if (!v) {
continue;
}
if (v->decoration_flags == 0) { // Regular input.
r_reflection.vertex_input_mask |= (((uint64_t)1) << v->location);
if (stage == SHADER_STAGE_VERTEX) {
if (v->decoration_flags == 0) { // Regular input.
r_reflection.vertex_input_mask |= (((uint64_t)1) << v->location);
}
}
if (v->built_in == SpvBuiltInViewIndex || v->built_in == SpvBuiltInViewportIndex) {
if (v->built_in == SpvBuiltInViewIndex) {
r_reflection.has_multiview = true;
}
}
@ -1259,9 +1261,6 @@ Error RenderingDeviceCommons::reflect_spirv(VectorView<ShaderStageSPIRVData> p_s
if (refvar->built_in != SpvBuiltInFragDepth) {
r_reflection.fragment_output_mask |= 1 << refvar->location;
}
if (refvar->built_in == SpvBuiltInViewIndex || refvar->built_in == SpvBuiltInViewportIndex) {
r_reflection.has_multiview = true;
}
}
}
}