From 2f83b400a881a3b7e78a2bd088e184752940309e Mon Sep 17 00:00:00 2001 From: clayjohn Date: Fri, 12 Apr 2024 10:31:36 -0700 Subject: Warn users when assigning VERTEX directly to POSITION due to compatibility breakage from reverse z changes --- servers/rendering/shader_warnings.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'servers/rendering/shader_warnings.cpp') diff --git a/servers/rendering/shader_warnings.cpp b/servers/rendering/shader_warnings.cpp index dce8f6cff1..3b99f6c2bf 100644 --- a/servers/rendering/shader_warnings.cpp +++ b/servers/rendering/shader_warnings.cpp @@ -65,6 +65,8 @@ String ShaderWarning::get_message() const { return subject; case DEVICE_LIMIT_EXCEEDED: return vformat(RTR("The total size of the %s for this shader on this device has been exceeded (%d/%d). The shader may not work correctly."), subject, (int)extra_args[0], (int)extra_args[1]); + case MAGIC_POSITION_WRITE: + return vformat(RTR("You are attempting to assign the VERTEX position in model space to the vertex POSITION in clip space. The definition of clip space changed in version 4.3, so if this code was written prior to 4.3, it will not continue to work. Consider specifying the clip space z-component directly i.e. use `vec4(VERTEX.xy, 1.0, 1.0)`.")); default: break; } @@ -92,6 +94,7 @@ String ShaderWarning::get_name_from_code(Code p_code) { "UNUSED_LOCAL_VARIABLE", "FORMATTING_ERROR", "DEVICE_LIMIT_EXCEEDED", + "MAGIC_POSITION_WRITE", }; static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names."); @@ -122,6 +125,7 @@ static void init_code_to_flags_map() { code_to_flags_map->insert(ShaderWarning::UNUSED_LOCAL_VARIABLE, ShaderWarning::UNUSED_LOCAL_VARIABLE_FLAG); code_to_flags_map->insert(ShaderWarning::FORMATTING_ERROR, ShaderWarning::FORMATTING_ERROR_FLAG); code_to_flags_map->insert(ShaderWarning::DEVICE_LIMIT_EXCEEDED, ShaderWarning::DEVICE_LIMIT_EXCEEDED_FLAG); + code_to_flags_map->insert(ShaderWarning::MAGIC_POSITION_WRITE, ShaderWarning::MAGIC_POSITION_WRITE_FLAG); } ShaderWarning::CodeFlags ShaderWarning::get_flags_from_codemap(const HashMap &p_map) { -- cgit v1.2.3