From f5776b7f191f83db38fb18a2787c6d5fe87756cb Mon Sep 17 00:00:00 2001 From: Jim Van Verth Date: Mon, 1 Jun 2020 15:30:47 -0400 Subject: [PATCH] Fix RTAdjust for Direct3D. D3D's NDC space is y-flipped compared to Vulkan and Metal. Change-Id: I9ab55efd431f2db877cea8e55d78eec737655a38 Bug: skia:9935 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293341 Reviewed-by: Greg Daniel Commit-Queue: Jim Van Verth --- src/gpu/d3d/GrD3DPipelineState.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gpu/d3d/GrD3DPipelineState.h b/src/gpu/d3d/GrD3DPipelineState.h index a62d44545c..63c54825b7 100644 --- a/src/gpu/d3d/GrD3DPipelineState.h +++ b/src/gpu/d3d/GrD3DPipelineState.h @@ -88,7 +88,8 @@ private: void getRTAdjustmentVec(float* destVec) { destVec[0] = 2.f / fRenderTargetSize.fWidth; destVec[1] = -1.f; - if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) { + // D3D's NDC space is flipped from Vulkan and Metal + if (kTopLeft_GrSurfaceOrigin == fRenderTargetOrigin) { destVec[2] = -2.f / fRenderTargetSize.fHeight; destVec[3] = 1.f; } else {