瀏覽代碼

Merge pull request #106925 from stuartcarnie/metal_fix_multiview

Metal: Fix multi-view support
Rémi Verschelde 3 月之前
父節點
當前提交
b89c47bb85
共有 1 個文件被更改,包括 6 次插入7 次删除
  1. 6 7
      servers/rendering/rendering_device_commons.cpp

+ 6 - 7
servers/rendering/rendering_device_commons.cpp

@@ -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;
-						}
 					}
 				}
 			}