git.s-ol.nu ~forks/DiligentTools / e51eb55
Fixed ImGUI framebuffer scale Thomas Tissot 1 year, 11 days ago
1 changed file(s) with 14 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
532532 pCtx->SetBlendFactors(blend_factor);
533533
534534 Viewport vp;
535 vp.Width = static_cast<float>(m_RenderSurfaceWidth);
536 vp.Height = static_cast<float>(m_RenderSurfaceHeight);
535 vp.Width = static_cast<float>(m_RenderSurfaceWidth) * pDrawData->FramebufferScale.x;
536 vp.Height = static_cast<float>(m_RenderSurfaceHeight) * pDrawData->FramebufferScale.y;
537537 vp.MinDepth = 0.0f;
538538 vp.MaxDepth = 1.0f;
539539 vp.TopLeftX = vp.TopLeftY = 0;
540 pCtx->SetViewports(1, &vp, m_RenderSurfaceWidth, m_RenderSurfaceHeight);
540 pCtx->SetViewports(1,
541 &vp,
542 static_cast<Uint32>(m_RenderSurfaceWidth * pDrawData->FramebufferScale.x),
543 static_cast<Uint32>(m_RenderSurfaceHeight * pDrawData->FramebufferScale.y));
541544 };
542545
543546 SetupRenderState();
567570 // Apply scissor/clipping rectangle
568571 float4 ClipRect //
569572 {
570 pcmd->ClipRect.x - pDrawData->DisplayPos.x,
571 pcmd->ClipRect.y - pDrawData->DisplayPos.y,
572 pcmd->ClipRect.z - pDrawData->DisplayPos.x,
573 pcmd->ClipRect.w - pDrawData->DisplayPos.y //
573 (pcmd->ClipRect.x - pDrawData->DisplayPos.x) * pDrawData->FramebufferScale.x,
574 (pcmd->ClipRect.y - pDrawData->DisplayPos.y) * pDrawData->FramebufferScale.y,
575 (pcmd->ClipRect.z - pDrawData->DisplayPos.x) * pDrawData->FramebufferScale.x,
576 (pcmd->ClipRect.w - pDrawData->DisplayPos.y) * pDrawData->FramebufferScale.y //
574577 };
575578 // Apply pretransform
576579 ClipRect = TransformClipRect(pDrawData->DisplaySize, ClipRect);
582585 static_cast<Int32>(ClipRect.z),
583586 static_cast<Int32>(ClipRect.w) //
584587 };
585 pCtx->SetScissorRects(1, &r, m_RenderSurfaceWidth, m_RenderSurfaceHeight);
588 pCtx->SetScissorRects(1,
589 &r,
590 static_cast<Uint32>(m_RenderSurfaceWidth * pDrawData->FramebufferScale.x),
591 static_cast<Uint32>(m_RenderSurfaceHeight * pDrawData->FramebufferScale.y));
586592
587593 // Bind texture, Draw
588594 auto* texture_srv = reinterpret_cast<ITextureView*>(pcmd->TextureId);