mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 07:31:16 +00:00 
			
		
		
		
	Merge pull request #72433 from clayjohn/Pointlight2D-crash
Avoid crash when CanvasTexture used with light decal atlas
This commit is contained in:
		
						commit
						c24e0065b2
					
				
					 3 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1499,6 +1499,9 @@ void RasterizerCanvasGLES3::light_set_texture(RID p_rid, RID p_texture) {
 | 
			
		|||
	if (cl->texture == p_texture) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
 | 
			
		||||
 | 
			
		||||
	if (cl->texture.is_valid()) {
 | 
			
		||||
		texture_storage->texture_remove_from_texture_atlas(cl->texture);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1550,6 +1550,9 @@ void RendererCanvasRenderRD::light_set_texture(RID p_rid, RID p_texture) {
 | 
			
		|||
	if (cl->texture == p_texture) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
 | 
			
		||||
 | 
			
		||||
	if (cl->texture.is_valid()) {
 | 
			
		||||
		texture_storage->texture_remove_from_decal_atlas(cl->texture);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -232,6 +232,8 @@ void LightStorage::light_set_projector(RID p_light, RID p_texture) {
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ERR_FAIL_COND(p_texture.is_valid() && !texture_storage->owns_texture(p_texture));
 | 
			
		||||
 | 
			
		||||
	if (light->type != RS::LIGHT_DIRECTIONAL && light->projector.is_valid()) {
 | 
			
		||||
		texture_storage->texture_remove_from_decal_atlas(light->projector, light->type == RS::LIGHT_OMNI);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue