### Godot version

4.0rc1 gl_compatibility only.

### System information

Windows 10, Nvidia 527.56 RTX3090, gl_compatibility
OpenGL API 3.3.0 NVIDIA 527.56 - Compatibility

### Issue description

Assigning a `CanvasItemMatrial` with `blend_mode = BLEND_MODE_SUB` in opengl causes the entire editor to turn black and break, even if later unassigned.

In case it matters, I'm using Single Window Mode in the editor.

### Steps to reproduce

1. Open the attached Project. Make sure it is using **Compatibility** on the top right.
2. On the root "Level" node, click the `Use Standard` checkbox which runs the tool script (it actually sets a CanvasItemMaterial, not standard. the checkbox was badly named). The editor turns black.
3. Without moving the mouse, click again to toggle this material off and return to a ShaderMaterial. The editor is still black / broken.
4. Press Ctrl-S to save the scene so you aren't bombarded with an invisible save dialog.
5. Close the editor.

If you edit the script and try other blend_mode values, this issue does not happen.

### Minimal reproduction project

[black_screen_test.zip](https://github.com/godotengine/godot/files/10689627/black_screen_test.zip)

src_rect = Rect2(0, 0, 1, 1);
				} else {
					if (np->source != Rect2()) {
						src_rect = Rect2(np->source.position.x * texpixel_size.width, np->source.position.y * texpixel_size.height, np->source.size.x * texpixel_size.width, np->source.size.y * texpixel_size.height);
						state.instance_data_array[r_index].color_texture_pixel_size[0] = 1.0 / np->source.size.width;
						state.instance_data_array[r_index].color_texture_pixel_size[1] = 1.0 / np->source.size.height;
					} else {
						src_rect = Rect2(0, 0, 1, 1);
					}
				}
				state.instance_data_array[r_index].modulation[0] = np->color.r * base_color.r;
				state.instance_data_array[r_index].modulation[1] = np->color.g * base_color.g;
				state.instance_data_array[r_index].modulation[2] = np->color.b * base_color.b;
				state.instance_data_array[r_index].modulation[3] = np->color.a * base_color.a;
				state.instance_data_array[r_index].src_rect[0] = src_rect.position.x;
				state.instance_data_array[r_index].src_rect[1] = src_rect.position.y;
				state.instance_data_array[r_index].src_rect[2] = src_rect.size.width;
				state.instance_data_array[r_index].src_rect[3] = src_rect.size.height;
				state.instance_data_array[r_index].dst_rect[0] = dst_rect.position.x;
				state.instance_data_array[r_index].dst_rect[1] = dst_rect.position.y;
				state.instance_data_array[r_index].dst_rect[2] = dst_rect.size.width;
				state.instance_data_array[r_index].dst_rect[3] = dst_rect.size.height;
				state.instance_data_array[r_index].flags |= int(np->axis_x) << FLAGS_NINEPATCH_H_MODE_SHIFT;
				state.instance_data_array[r_index].flags |= int(np->axis_y) << FLAGS_NINEPATCH_V_MODE_SHIFT;
				if (np->draw_center) {
					state.instance_data_array[r_index].flags |= FLAGS_NINEPACH_DRAW_CENTER;
				}
				state.instance_data_array[r_index].ninepatch_margins[0] = np->margin[SIDE_LEFT];
				state.instance_data_array[r_index].ninepatch_margins[1] = np->margin[SIDE_TOP];
				state.instance_data_array[r_index].ninepatch_margins[2] = np->margin[SIDE_RIGHT];