mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-04 15:11:05 +01:00 
			
		
		
		
	Backends: DX12: Fix D3D12 Debug Layer warning if scissor rect is 0 width or 0 height. (#3472, #3462)
In the event where the scissor rect is 0 width or 0 height, don't call Draw, as it generates warnings if the D3D12 Debug Layer is enabled, and nothing would have been drawn anyway.
This commit is contained in:
		
				
					committed by
					
						
						omar
					
				
			
			
				
	
			
			
			
						parent
						
							a8f409a848
						
					
				
				
					commit
					a1597cff08
				
			@@ -70,6 +70,7 @@ Other Changes:
 | 
				
			|||||||
  own render pass. (#3455, #3459) [@FunMiles]
 | 
					  own render pass. (#3455, #3459) [@FunMiles]
 | 
				
			||||||
- Backends: DX12: Clarified that imgui_impl_dx12 can be compiled on 32-bit systems by redefining
 | 
					- Backends: DX12: Clarified that imgui_impl_dx12 can be compiled on 32-bit systems by redefining
 | 
				
			||||||
  the ImTextureID to be 64-bit (e.g. '#define ImTextureID ImU64' in imconfig.h). (#301)
 | 
					  the ImTextureID to be 64-bit (e.g. '#define ImTextureID ImU64' in imconfig.h). (#301)
 | 
				
			||||||
 | 
					- Backends: DX12: Fix debug layer warning when scissor rect is zero-sized. (#3472, #3462) [@StoneWolf]
 | 
				
			||||||
- Examples: Vulkan: Reworked buffer resize handling, fix for Linux/X11. (#3390, #2626) [@RoryO]
 | 
					- Examples: Vulkan: Reworked buffer resize handling, fix for Linux/X11. (#3390, #2626) [@RoryO]
 | 
				
			||||||
- Examples: Vulkan: Switch validation layer to use "VK_LAYER_KHRONOS_validation" instead of
 | 
					- Examples: Vulkan: Switch validation layer to use "VK_LAYER_KHRONOS_validation" instead of
 | 
				
			||||||
  "VK_LAYER_LUNARG_standard_validation" which is deprecated (#3459) [@FunMiles]
 | 
					  "VK_LAYER_LUNARG_standard_validation" which is deprecated (#3459) [@FunMiles]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -235,11 +235,14 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                // Apply Scissor, Bind texture, Draw
 | 
					                // Apply Scissor, Bind texture, Draw
 | 
				
			||||||
                const D3D12_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
 | 
					                const D3D12_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
 | 
				
			||||||
 | 
					                if (r.right > r.left && r.bottom > r.top)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
                    ctx->SetGraphicsRootDescriptorTable(1, *(D3D12_GPU_DESCRIPTOR_HANDLE*)&pcmd->TextureId);
 | 
					                    ctx->SetGraphicsRootDescriptorTable(1, *(D3D12_GPU_DESCRIPTOR_HANDLE*)&pcmd->TextureId);
 | 
				
			||||||
                    ctx->RSSetScissorRects(1, &r);
 | 
					                    ctx->RSSetScissorRects(1, &r);
 | 
				
			||||||
                    ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
 | 
					                    ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        global_idx_offset += cmd_list->IdxBuffer.Size;
 | 
					        global_idx_offset += cmd_list->IdxBuffer.Size;
 | 
				
			||||||
        global_vtx_offset += cmd_list->VtxBuffer.Size;
 | 
					        global_vtx_offset += cmd_list->VtxBuffer.Size;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user